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. Combining Columns In A ResultSet

Combining Columns In A ResultSet

Scheduled Pinned Locked Moved Database
databasemysqlsql-serversysadmin
3 Posts 3 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.
  • S Offline
    S Offline
    Samuel G
    wrote on last edited by
    #1

    Hi,I want to display two columns from one table in a Web Form dropdownlist,I've tried something like this @"SELECT TeamA FROM Under11s. UNION SELECT TeamB FROM Under11s;"; But the result set mixes the columns I want them grouped together like "TeamA" Player1 Player2 Player3 "TeamB" Player1 Player2 Player3 SQl Server Or MySql. Flip Gabes

    P E 2 Replies Last reply
    0
    • S Samuel G

      Hi,I want to display two columns from one table in a Web Form dropdownlist,I've tried something like this @"SELECT TeamA FROM Under11s. UNION SELECT TeamB FROM Under11s;"; But the result set mixes the columns I want them grouped together like "TeamA" Player1 Player2 Player3 "TeamB" Player1 Player2 Player3 SQl Server Or MySql. Flip Gabes

      P Offline
      P Offline
      Private_Void
      wrote on last edited by
      #2

      You are close make your query look like this; SELECT TeamA FROM Under11s. UNION ALL SELECT TeamB FROM Under11s This should work.

      1 Reply Last reply
      0
      • S Samuel G

        Hi,I want to display two columns from one table in a Web Form dropdownlist,I've tried something like this @"SELECT TeamA FROM Under11s. UNION SELECT TeamB FROM Under11s;"; But the result set mixes the columns I want them grouped together like "TeamA" Player1 Player2 Player3 "TeamB" Player1 Player2 Player3 SQl Server Or MySql. Flip Gabes

        E Offline
        E Offline
        Eric Dahlvang
        wrote on last edited by
        #3

        SELECT TeamA,1 as SortCol FROM Under11s UNION SELECT TeamB,2 as SortCol FROM Under11s order by SortCol,TeamB

        --EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters

        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