I have 4 tables, each with a one-to-many relationship:
client -< inspection -< car -< issue
and I'm trying to select the name and the address of a client along with the count of the inspections and the count of the issues.
Here is what I have so far: http://ift.tt/1BkWKTl
In the example above the result for client._id = 1 should be:
client_name client_address Inspection count Issue count
"John" "1 Main street" 2 3
and for client._id = 2 it should be:
client_name client_address Inspection count Issue count
"Jane" "1 Wall street" 0 0
Is it possible to achieve this result in one query, or do I have to use a subquery for issue count?
Aucun commentaire:
Enregistrer un commentaire