MySQL Forums
Forum List  »  Newbie

Return zero instead of nothing
Posted by: Jared Valarta
Date: April 06, 2006 08:19PM

I hope this isnt a stupid question, Ive searched high and low and the answer doesnt seem obvious.

I want this query to return a zero on the days of selection that have no record.

SELECT thedate, thecount FROM thetable WHERE DATE_SUB('$Today',INTERVAL 6 DAY) <= thedate AND thedate <= '$Today' && ID = $ID ORDER BY thedate ASC

So it works great if all the days in the selection have a value. If one of the days in the sequence has no record, then it skips it, and thus no value is presented.

The question is, how do I get mysql to give me a zero if it doesnt find anything?

Options: ReplyQuote


Subject
Written By
Posted
Return zero instead of nothing
April 06, 2006 08:19PM


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.