rashmi_k28 Posted March 24, 2008 Share Posted March 24, 2008 Here I will get the output as empty set. How can I make to get value as -1 when there is empty set if status=1. Please help me with this select * from updowntime where status=1 and date(timestamp)=date(now()) and timestamp > '2008-03-24 11:10:01' and name='aaa'; Quote Link to comment https://forums.phpfreaks.com/topic/97570-ifnull/ Share on other sites More sharing options...
fenway Posted March 25, 2008 Share Posted March 25, 2008 get what value? if what is null? Quote Link to comment https://forums.phpfreaks.com/topic/97570-ifnull/#findComment-500676 Share on other sites More sharing options...
rashmi_k28 Posted March 26, 2008 Author Share Posted March 26, 2008 If there is no timestamp which is greater with status=1 Quote Link to comment https://forums.phpfreaks.com/topic/97570-ifnull/#findComment-501061 Share on other sites More sharing options...
aschk Posted March 26, 2008 Share Posted March 26, 2008 Basically i think he's asking how do you get "-1" when NO rows are being returned. Use your application, not the SQL. Unless you want to put it into a function, but then again if you put it into a function you can't return rows from a SQL statement, which is I would imagine what you're intending to do. In summary: NO you can't because no rows are being returned. Use your application to determine this, or use SQL_CALC_ROWS, of couse this requires integrating it with your query/procedure as a separate step. Quote Link to comment https://forums.phpfreaks.com/topic/97570-ifnull/#findComment-501079 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.