craigmeihana
asked on
Need to query to join a one table to another table. Problem is that the other table has Foriegn key fields that I need included as well.
Hi, I am currently extracting information from a sql database into an excel spreedsheet. I am needing the information to be placed into first normal form, which leads me to this current issue. I need to be able to query many tables and draw out information from all of them. My problem is that the second table that i want to join has FK fields which reference other tables. I need to have the FK columns updated with data from the other tables and then joined onto the first table.
I can currently do this sepeartely with two seperate querys. Problem is joining those querys so that the information in the other tables is all drawn together.
e.g
tableA
tableaID PK
column1
column2
column3
tableB
tablebID PK
tableaID FK
Column4
column5
tableCIDFK
tableC
tablecIDPK
column6
column7
select * from tableA
left outer join on tableA.tableaid = tableB.tableaID;
so that will link all the data from tableB to tableA.
select * from tableB
left outer join on tableB.tableCid = tableC.tableCID;
And that will draw all the information from tableB and tableC.
But unable join both querys?
How is it possible to do a query which selects all the information from TableA and joins the related information from tableB and tableC?
I can currently do this sepeartely with two seperate querys. Problem is joining those querys so that the information in the other tables is all drawn together.
e.g
tableA
tableaID PK
column1
column2
column3
tableB
tablebID PK
tableaID FK
Column4
column5
tableCIDFK
tableC
tablecIDPK
column6
column7
select * from tableA
left outer join on tableA.tableaid = tableB.tableaID;
so that will link all the data from tableB to tableA.
select * from tableB
left outer join on tableB.tableCid = tableC.tableCID;
And that will draw all the information from tableB and tableC.
But unable join both querys?
How is it possible to do a query which selects all the information from TableA and joins the related information from tableB and tableC?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
glad to be of help, thanx for the grade.
Ed.
Ed.
ASKER
Thanks.