Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kagitas
Starting Member
2 Posts |
Posted - 2004-07-25 : 00:20:17
|
| Hi,I have few queries with me Say :A) Select A from AAAB) Select B from BBBC) Select C from CCCwhat i would like to know is can i put the above queries into a single query.Thanks in advance,Jaya.... |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-07-25 : 02:04:03
|
| You can combine all results with UNION.SELECT A FROM AAAUNION ALLSELECT B FROM BBBUNION ALLSELECT C FROM CCC--KenYour Kung-Fu is not strong. -- 'The Core' |
 |
|
|
kagitas
Starting Member
2 Posts |
Posted - 2004-07-26 : 01:31:07
|
| Thank you very much kselvia but what i am expecting isA) Select A from AAAB) Select B from BBBC) Select C from CCCinto a single result set ColA ColB ColC as output: A B C 1st row a1's b1's c1's2nd row a2's b2's c2's3rd row a3's b3's c3's4th row a4's b4's c4'sCan you give me solution for this. Thanks in advanceJaya.. |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-26 : 01:45:04
|
| Do you have a rownumber on each field or something that relates the tables? Your example doesn't make any sense really. Why don't you give us the CREATE TABLE for the three tables, some sample INSERT statements for each table, and a result set that you are expecting from the sample data.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-26 : 01:51:22
|
| Maybe something like[code]SELECT A, B, CFROM AAA LEFT OUTER JOIN BBB ON BBB.ID = AAA.ID LEFT OUTER JOIN CCC ON CCC.ID = AAA.IDORDER BY AAA.ID[code]Kristen |
 |
|
|
|
|
|