Ingo Foerster
asked on
Second left Join with count
Add a third table to a query that works well.
I have the following query:
This brings the right result. Now I want to add the single query
But this will end in a error. Any hint?
I have the following query:
"SELECT * FROM (Select test_case.id,test_case.description,test_case.folder,test_case.pubstate,test_case.owner,test_case.last_state_mrdev,test_case.usebxf22 FROM test_case )t1 LEFT JOIN (SELECT * FROM case_additional)t2 ON t1.id = t2.case_id "
This brings the right result. Now I want to add the single query
SELECT COUNT(*) AS total FROM test_comments WHERE test_comments.case_id=t1.id
To the query above to get the "total" as additional filed in the query result. How I n do this? Two left join? I expected "SELECT * FROM (Select test_case.id,test_case.description,test_case.folder,test_case.pubstate,test_case.owner,test_case.last_state_mrdev,test_case.usebxf22 FROM test_case )t1 LEFT JOIN (SELECT * FROM case_additional)t2 ON t1.id = t2.case_id LEFT JOIN SELECT t3.*,COUNT(*) AS total FROM test_comments ON t1.id = t3.case_id"
But this will end in a error. Any hint?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER