Date SELECT with IF
| From: | Shaun | Date: | Thu, 15 Apr 2004 17:44:51 +0000 |
| Subject: | Date SELECT with IF | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33912@lists.php.net to get a copy of this message | ||
Hi,
Is it possible to have a clause in a mysql SELECT statement? I would the
query to display the date except where it equals the default 000-00-00 to
display n/a or something similar.
For example SELECT DATE_FORMAT(B.Booking_End_Date, \"%Y-%m-%d\") AS 'Booking
End Date' FROM Bookings (IF Booking_End_Date = '0000-00-00' DISPLAY 'n/a');
I hope this illustrates what I am trying to achieve!
Thanks for your help