mysql query for current date accounting returns NULL

JAHANZAIB SYED <[email protected]>
Newsgroups gmane.comp.db.mysql.general
Message-ID <[email protected]>
I have Freeradius 2.x with MySQL 5.5 in Ubuntu. 

I want to query user quota for current date. I am using following code

SELECT (SUM(acctinputoctets)+SUM(acctoutputoctets)) AS Total FROM radacct where (acctstarttime between  DATE_FORMAT(NOW(),'%Y-%m-%d') AND NOW() AND acctstoptime  between  DATE_FORMAT(NOW() ,'%Y-%m-%d') AND NOW()) AND radacct.username='%{User-Name}'

It works fine if there is acctstoptime value in table. but if user have not disconnected yet (and have no previous session for today) it returns NULL.

So how can i can get the value even if user acttstoptime is null?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.