hello!
Code:Tbl1 id name Tbl1 ROWS id name 1 name1 2 name2 3 name3 Tbl2 id tbl1_id Tbl2 ROWS id tbl1_id 1 1 2 1 3 2
I have 2 tables with a foreign key in Tbl2. I'm looking for the sql to list all rows in Tbl1 and count how many rows match the Tbl1.id in Tbl2 and display it in the row.
I want the out put to read:
id name count
1 name1 2
2 name2 1
3 name3 0
Is this possible? Thanks in advance for your help!




Reply With Quote