| 
	
 | 
 Posted by <talthen.z-serwera.o2 on 06/18/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] 
 |