0
SELECT p.value AS __color__,
milestone AS __group__,
milestone,
priority,
time AS created,
COUNT(t.id) as 'total open tickets',
SUM(c.value) as 'Total Dev LOE',
SUM(d.value) as 'Total QALOE'
FROM ticket t
LEFT JOIN ticket_custom c ON (t.id = c.ticket AND c.name = 'devloe')
LEFT JOIN ticket_custom d ON (t.id = d.ticket AND d.name = 'qaloe')
LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
WHERE t.milestone = '$MILESTONE'
AND status <> 'closed'
GROUP BY milestone, priority, DATE(FROM_UNIXTIME(time/1000000)) DESC
然後添加子查詢以返回每個優先級的總和devloe和qaloe。是否有可能使用子查詢返回多行的查詢?
目前還不清楚你想要什麼。請發佈樣本期望的輸出。 – 2011-02-26 04:03:33