Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Help - Count records in 2nd table

Status
Not open for further replies.

baden

Programmer
Feb 6, 2002
125
US
Brain stopped working on this one...

Create a result set with all records from table A and counted related records in table B, joined w/ B.FK = A.PK .


Thanks.

 
Code:
select a.c1,a.c2, ... , count(b.fk)
from a left join b on a.pk = b.fk
group by a.c1,a.c2, ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top