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'; 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? 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 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. Link to comment https://forums.phpfreaks.com/topic/97570-ifnull/#findComment-501079 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.