MySQL Forums
Forum List  »  Optimizer & Parser

LEFT JOIN WHERE GROUP BY
Posted by: Daniel Flöijer
Date: April 02, 2012 02:51AM

I have an SQL statement that works, but I'd like to improve it by adding 0/null results for statuses that has not been used during the given interval. However, I've not been able to figure out how. Anyone who's a SQL guru who can help me?

SELECT count(*), support_internalstatus.name FROM support
INNER JOIN support_internalstatus ON support_internalstatus.id = support.statusinternal_id
WHERE create_date >= '2011-02-01 00:00:00'
AND create_date <= '2011-02-31 23:59:59'
GROUP BY support_internalstatus.id

I found a similar issue here and tried to convert the statement to my needs, but failed: http://forums.mysql.com/read.php?115,381335,382841#msg-382841

Options: ReplyQuote


Subject
Views
Written By
Posted
LEFT JOIN WHERE GROUP BY
3035
April 02, 2012 02:51AM
1298
April 02, 2012 12:04PM
1327
April 02, 2012 01:24PM
1348
April 02, 2012 04:29PM
2014
April 03, 2012 12:50AM
1340
April 03, 2012 05:40PM
1441
April 03, 2012 11:22PM
1294
April 04, 2012 05:12PM
1044
April 04, 2012 11:10PM
1557
April 05, 2012 08:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.