①
SELECT IF(days = 1,"是","不是") as "是否星期天" FROM (SELECT DAYOFWEEK(FROM_UNIXTIME(time,"%Y-%m-%d")) AS days FROM table) tmp
---time是时间戳 , days = 1代表星期天
--把time 和 table 替换成你数据库的 字段和表
②
SELECT IF(days = 1,"是","不是") as "是否星期天" FROM (SELECT DAYOFWEEK(date) AS days FROM table) tmp
---date是日期格式 2017-11-21 , days = 1代表星期天
--把date 和 table 替换成你数据库的 字段和表
SELECT IF(days = 1,‘是’,‘不是’) as '星期天' FROM (SELECT DAYOFWEEK(date) AS days FROM ceshitable) tmp欢迎分享,转载请注明来源:内存溢出
评论列表(0条)