Hi,
I'm a programmer, but my SQL joins are really rusty right now.
This is a 1 to Many question. I separated the fields/fieldnames with bars.
I have 3 Tables I need to connect:
Table A = VENDOR (3 records)
----------------------------
VendorID | Name
1| Rooms To Go
2| TXU
3| Circuit City
Table B = CLIENT (8 records)
----------------------------
VendorID | ClientID
1| 20
1| 84
1| 2
1| 69
2| 20
2| 84
2| 2
2| 69
Table C = CLIENTNAME (100+ records)
----------------------------
ClientID | Clientname
20|Acme
84|Barnes
2|Baylor
69|Balda
I want my result set to look like:
VendorID(from VENDORS),Name(Vendors),AllClients(a derived column):
----------------------------------
1 |Rooms To Go |Acme, Barnes,Baylor,Balda
2 |TXU | Acme, Barnes,Baylor,Balda
3 |Circuit City
I need a little help on the joins, and in particular the sub-select I think I may need.
Here's what I have so far, but this initially connects the first two tables and also gives me more records than I'm looking for. I haven't added the 3rd table here yet.
SELECT distinct
v.*,
c.*
FROM vendors v LEFT OUTER JOIN
( select * from client) c
on v.vendorid = c.vendorid
Thanks in advance for any help you can provide.
I'm a programmer, but my SQL joins are really rusty right now.
This is a 1 to Many question. I separated the fields/fieldnames with bars.
I have 3 Tables I need to connect:
Table A = VENDOR (3 records)
----------------------------
VendorID | Name
1| Rooms To Go
2| TXU
3| Circuit City
Table B = CLIENT (8 records)
----------------------------
VendorID | ClientID
1| 20
1| 84
1| 2
1| 69
2| 20
2| 84
2| 2
2| 69
Table C = CLIENTNAME (100+ records)
----------------------------
ClientID | Clientname
20|Acme
84|Barnes
2|Baylor
69|Balda
I want my result set to look like:
VendorID(from VENDORS),Name(Vendors),AllClients(a derived column):
----------------------------------
1 |Rooms To Go |Acme, Barnes,Baylor,Balda
2 |TXU | Acme, Barnes,Baylor,Balda
3 |Circuit City
I need a little help on the joins, and in particular the sub-select I think I may need.
Here's what I have so far, but this initially connects the first two tables and also gives me more records than I'm looking for. I haven't added the 3rd table here yet.
SELECT distinct
v.*,
c.*
FROM vendors v LEFT OUTER JOIN
( select * from client) c
on v.vendorid = c.vendorid
Thanks in advance for any help you can provide.