Combining Columns In A ResultSet
-
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
-
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
You are close make your query look like this; SELECT TeamA FROM Under11s. UNION ALL SELECT TeamB FROM Under11s This should work.
-
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
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