Hmmm -
Off the top of my head, how about:
select
order, if(SUM(cat1+cat2)=0, '-', SUM(cat1+cat2)) as sum
from
tbl
group by
order
Although you might need to quote the column name 'order', since that
is a reserved word:
select
'order', ...
group by
'order'
I think there's probably a cleaner way to do it, but that _should_ work...
- steve
At 2:55 PM -0200 5/9/02, [EMAIL PROTECTED] wrote:
>Hello dear all,
>
>I need to make a simple select query like this:
>select order, SUM(cat1+cat2) from tbl
>when the result of the SUM is =0 i need to change this 0 and display a
>character like '-' .
>
>Is possible to do this? and how?
>
>thanks in advance,
>
>regards
>fabrizio
>
--
+------------------------------------------------------------------------+
| Steve Edberg [EMAIL PROTECTED] |
| University of California, Davis (530)754-9127 |
| Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ |
+------------------------------------------------------------------------+
| "If only life would imitate toys." |
| - Ted Raimi, March 2002 |
| - http://www.whoosh.org/issue67/friends67a.html#raimi |
+------------------------------------------------------------------------+
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php