MySQL Forums
Forum List  »  MySQL Query Browser

how can i add if else statement to this
Posted by: craiglongmuir
Date: October 14, 2005 09:06PM

hey all
i am making a birthday reminder and have a db with tbl_birthday with columns birthdayID, name, day(1-31), month(1-12)
i have this code so far

select name, colDay, colMonth
from tbl_birthday
where (colMonth > MONTH(CURDATE())) or (colMonth = MONTH(CURDATE()) AND colDay > DAYOFMONTH(CURDATE()))
ORDER BY colMonth, colDay
LIMIT 1

now this only works getting the next bd upto dec 31 so i need to loop back round to jan if no bds found.

so basically i want to say iff no results come from the select statement above, just display the bd results and order by colDay, colMonth

how do i do this

thanks

craig

Options: ReplyQuote


Subject
Written By
Posted
how can i add if else statement to this
October 14, 2005 09:06PM


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.