There are 2 tables here linked by task_id
This is my mysql query,
SELECT sum(l.hours)
,l.type
FROM task_details as st
LEFT JOIN log as l
ON l.task_id = st.task_id
WHERE st.task_id IN (1,2,3)
GROUP BY l.type,st.task_id with roll up
What I want is to first find the sum grouped on l.type and then on task_id.
But it is showing me the complete sum without grouping
WITH ROLLUPseems to be the problem here: http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html