lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
***BOGO*** Re: SELECT to return 0 instead of NULL?
- Date: Fri, 23 May 2008 08:32:25 -0700
- From: "Rob Wultsch" <wultsch@xxxxxxxxx>
- Subject: ***BOGO*** Re: SELECT to return 0 instead of NULL?
On Fri, May 23, 2008 at 8:23 AM, Tuc at T-B-O-H.NET <ml@xxxxxxxxxxx> wrote:
> Hi,
>
> I'm running a query :
>
> SELECT SUM(AcctSessionTime) FROM radacct WHERE UserName='hotspot';
>
> But if there aren't any rows in "radacct" for the UserName of
> "hotspot", it returns a NULL. Is there a way to change it to return 0
> instead? (I can't change the application, but I can change the SQL)
>
SELECT IFNULL( SUM(AcctSessionTime),0) FROM radacct WHERE UserName='hotspot';
--
Rob Wultsch
wultsch@xxxxxxxxx
wultsch (aim)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=royale@xxxxxxxxxx