Kyle Hamilton
asked on
need SQL query advice on cross referencing three tables
I'm trying to lear SQL. I'm a total noob, please bear with me.
I have these two queries, both of which work, but I'm hoping to get some advice as to which is preferable, or if there is a better way of doing it.
Basically, I have to cross reference three tables to get the info I'm looking for.
Thanks in advance, and apologies for any cringe factor...
Kyle
I have these two queries, both of which work, but I'm hoping to get some advice as to which is preferable, or if there is a better way of doing it.
SELECT AVG(price) AS PriceAverage FROM bib inner join (SELECT sub.subcode, accno FROM sub inner join indx on sub.subcode = indx.subcode where subject = 'SOCIAL CHANGE')A on bib.accno = A.accno;
SELECT AVG(price) AS PriceAverage FROM bib inner join (select accno,subcode from indx where subcode in ( select subcode from sub where subject = 'SOCIAL CHANGE'))A on bib.accno = A.accno;
Basically, I have to cross reference three tables to get the info I'm looking for.
Thanks in advance, and apologies for any cringe factor...
Kyle
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
:) no problem. cheers. Paul
ASKER
Best,
Kyle