MySQL Forums
Forum List  »  Newbie

Re: Group By With Rollup Question
Posted by: Jay Pipes
Date: June 29, 2005 10:31AM

(
SELECT
yr
, COUNT(yr) as nr
, ocode
FROM table1
WHERE dc=1
GROUP BY yr, ocode
HAVING COUNT(yr) = 1
)
UNION ALL
(
SELECT
yr
, COUNT(yr) as nr
, ocode
FROM table1
WHERE dc=1
GROUP BY yr, ocode
WITH ROLL UP
) ORDER BY yr, ocode DESC;

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote


Subject
Written By
Posted
Re: Group By With Rollup Question
June 29, 2005 10:31AM


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.