下面的选择将返回标题和日期。
SELECT t1.title, from_unixtime(cds1.field_id_34, '%d/%m/%y') AS s1_date
所以一切都是正确的,但如果 cds1.field_id_34
为 null,则返回 01/01/1970。我该如何设置它,以便如果 cds1.field_id_34
为空,它将返回 -
而不是 01/01/1970
最佳答案
select if(cds1.field_id_34=null,'-',cds1.field_id_34) from TableName
关于mysql from_unixtime(cds1.field_id_34, '%d/%m/%y' ) 如果 `date` 为 null 选择 `-`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27921621/