MySQL Forums
Forum List  »  MyISAM

Re: "WITH ROLLUP" and "NOT NULL" columns
Posted by: Felix Geerinckx
Date: November 15, 2005 12:31PM

[Your question has nothing to do with the MyISAM storage engine. Please pick a more appropriate forum next time]

Anthony Willard wrote:

> I'm trying to summarize some data and use the "WITH ROLLUP" clause to generate the totals. In
> my "SELECT", I'm trying to use a "CASE" statement to replace the "NULL" value produced by the "WITH
> ROLLUP" with text indicating that this row represents a break total for this column.

From http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html:

Because the NULL values in the super-aggregate rows are placed into the result set at such a late stage in query processing, you cannot test them as NULL values within the query itself. For example, you cannot add HAVING product IS NULL to the query to eliminate from the output all but the super-aggregate rows.

On the other hand, the NULL values do appear as NULL on the client side and can be tested as such using any MySQL client programming interface.

--
felix
Please use BBCode to format your messages in this forum.



Edited 1 time(s). Last edit at 11/15/2005 12:32PM by Felix Geerinckx.

Options: ReplyQuote


Subject
Views
Written By
Posted
4764
November 15, 2005 12:00PM
Re: "WITH ROLLUP" and "NOT NULL" columns
2901
November 15, 2005 12:31PM


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.