From: Cory Hicks [mailto:[EMAIL PROTECTED]

> Hello,
> 
> I must be having a goober moment.....I am running the following sql
> query with no problems:
> 
> SELECT project_id,
> IF (SUM( time_worked ) > '0.00', SUM( time_worked ),'NULL') AS total
> FROM time_daily
> WHERE user_id = 'clh' AND period_id = '27'
> GROUP BY project_id 
> 
> However, having 'NULL' appear where the total is 0.00 doesn't 
> do me much good :-) How do I write this query to only show me the 
> results where the total is > 0.00...so where the results that 
> total 0.00 don't appear at all.
> 
> I am sure I am missing something...thanks for any help!


SELECT project_id,
IF (SUM( time_worked ) > '0.00', SUM( time_worked ),'NULL') AS total
FROM time_daily
WHERE user_id = 'clh' AND period_id = '27' AND total IS NOT NULL 
GROUP BY project_id;

That should work, though I haven't tested it.


-- 
Mike Johnson
Web Developer
Smarter Living, Inc.
phone (617) 886-5539

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to