Return to Snippet

Revision: 5112
at February 12, 2008 10:21 by Abe


Initial Code
# Original SQL
SELECT name, last_name, birthday FROM people

#Modified SQL
SELECT name, last_name, IF( birthday = '0000-00-00',  NULL, birthday) AS birthday FROM people

Initial URL
http://www.estadobeta.com/2008/02/12/la-fecha-0000-00-00-de-mysql/

Initial Description
An easy way to handle null dates. If date = 0000-00-00 then null, else use date

Initial Title
Date 0000-00-00

Initial Tags
sql, date

Initial Language
SQL