All pastes #178950 Raw Edit

Untitled

public text v1 · immutable
#178950 ·published 2006-09-21 19:17 UTC
rendered paste body
SELECT t.*, count(usr.id) as userCount, count(com.id) as commentCount from `todoItems` t 
LEFT JOIN `userTodoList` usr ON t.id = usr.todoItemId 
LEFT JOIN `comments` com ON t.discussionId = com.discussionId
GROUP BY t.id order by count(com.id) desc;