bogu wrote:What exactly do u need to find?
U need to find for each d.iddie how many r.idreadsummary are?
that should be something like this:
SELECT
d.iddie, COUNT(r.idreadsummary) as nr
FROM die d
LEFT JOIN readsummary r USING(iddie)
GROUP BY d.iddie
Maybe u can give us an example with your two tables with a few rec., how the table are linked with each other and what results do u want ..
I know, I'm not doing the best job explaining it. Let me show the tables first:
table die
iddie name
1 02H1
2 02H1
3 03G0
...and so on. the readsummary table has the following:
table readsummary
idreadsummary iddie
1 1
2 1
3 1
4 1
5 2
...and so on. What I want to do is get the row count where name equals something, let's say 0H1. For the above example that would be 2. Then I want to get the row count for where those iddie's are found in the readsummary table, which would be 5. When I tried using joins I got 5 back for both row counts, which isn't correct. Normally I could do more than one SELECT command, but it tends to add up on our server, so I'mm looking for a way to consolidate the SQL code. Again, thanks for your help!