sql语句

1.按字段是否空分组,mysql数据库

SELECT
SUM(t.PROJECT_UNIT_COUNT) AS PROJECT_UNIT_COUNT,
COUNT(*) AS PROJECT_COUNT
FROM QS_PROJECT t GROUP BY ISNULL(t.`xx`)

2.根据出生日期,更新年龄字段

UPDATE `tp_infocollect_regs_base` SET age = DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW()) - TO_DAYS(birthday)),'%Y')+1

posted on 2016-08-12 11:55  泽口靖子  阅读(131)  评论(0编辑  收藏  举报

导航