You are here: Re: How can I specify 'NO' as default value for datetime value or convert default value into 'NO' in query? « PHP SQL « IT news, forums, messages
Re: How can I specify 'NO' as default value for datetime value or convert default value into 'NO' in query?

Posted by <talthen.z-serwera.o2 on 10/14/27 11:46

> When I fill datetime field with empty string I get "0000-00-00 00:00:00"-
> it's fine, but when I display it I want the string 'NO' instead of these
> zeros.
> So... how can I specify 'NO' as default value for datetime value?
> OR
> How can I show dates and replace all dates="0000-00-00 00:00:00" with
> 'NO'?
>
> All I have made is-
> SELECT 'NO' FROM `tab` WHERE SUBSTRING(date,0,1)='0'
> But I dunno how do add showing non-zero dates... in one query.

SELECT IF (SUBSTRING(`date`,1,1)='0','NO',`date`) from `tab`;

Works fine, but... is there a way to set the default value to NO?

Regards,
Talthen

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация