Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Need Help

Need Help

Scheduled Pinned Locked Moved Database
help
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    banker_kiran
    wrote on last edited by
    #1

    Hi, Master Table SMID(int) Descr(varchar) 43  A 47  B 208  C 502  D 549  E Child Table Descr_SMID(varchar) 208 502,549,43,47 502,549 Now I want result like this using count. A (1) B (1) C (1) D (2) E (2)

    kiran banker

    C P 2 Replies Last reply
    0
    • B banker_kiran

      Hi, Master Table SMID(int) Descr(varchar) 43  A 47  B 208  C 502  D 549  E Child Table Descr_SMID(varchar) 208 502,549,43,47 502,549 Now I want result like this using count. A (1) B (1) C (1) D (2) E (2)

      kiran banker

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      I don't follow the table layout, but it looks like you need something like select sum(count), letter from tbl group by letter where letter is the column that gives you A/B/C and count is the column you want to combine. use count instead of sum if you're counting columns and not combining their values

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • B banker_kiran

        Hi, Master Table SMID(int) Descr(varchar) 43  A 47  B 208  C 502  D 549  E Child Table Descr_SMID(varchar) 208 502,549,43,47 502,549 Now I want result like this using count. A (1) B (1) C (1) D (2) E (2)

        kiran banker

        P Offline
        P Offline
        pmarfleet
        wrote on last edited by
        #3

        banker_kiran wrote:

        Child Table Descr_SMID(varchar) 208 502,549,43,47 502,549

        Your child table violates one of the principles of 1st normal form. Values for each column-row intersection should be atomic. You should consider splitting these values out, otherwise it will be very difficult to query the data efficiently.

        Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

        P 1 Reply Last reply
        0
        • P pmarfleet

          banker_kiran wrote:

          Child Table Descr_SMID(varchar) 208 502,549,43,47 502,549

          Your child table violates one of the principles of 1st normal form. Values for each column-row intersection should be atomic. You should consider splitting these values out, otherwise it will be very difficult to query the data efficiently.

          Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

          P Offline
          P Offline
          Paul Conrad
          wrote on last edited by
          #4

          pmarfleet wrote:

          Your child table violates one of the principles of 1st normal form

          Yes, it certainly does.

          "The clue train passed his station without stopping." - John Simmons / outlaw programmer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups