Menu

#37 Use one query to get rows + child existence

open
data query (2)
5
2003-08-06
2003-08-06
No

Instead of using one query to get rows, and another go
get those with children, use one query to reduce
communication with the backend:

select c.composer_id,
c.composer_name,
(select count(*) from werk
where w.composer_id=c.composer_id)
as nchildren
from composer;

Discussion


Log in to post a comment.

MongoDB Logo MongoDB