KILL MUTATION WHERE database ='aaa' AND table ='user';
– 18、分组
group by user.userType,formatDateTime(toDate(`user`.`timestamp`),'%Y-%m')
– 19、排序
order by toDate(`user`.`timestamp`), `bcs`.`userType` desc;
– 20、WHEN…THEN…
WHEN `user`.`userType`='企业A' THEN '企业' WHEN `user`.`userType`='企业B' THEN '企业'
– 21、关于字符串(yyyy-MM-dd HH:mm:ss)转日期类型补充
空值处理
* toDateTimeOrNull
* toDateTimeTimeOrZero
* parseDateTimeBestEffort
* parseDateTimeBestEffortOrNull
* parseDateTimeBestEffortOrZero
Pick the one depending or your needs. Variants with 'or' don't throw exceptions on bad strings.
-21、关于字符串(yyyy-MM-dd HH:mm:ss)转日期类型补充
There are
* toDateTimeOrNull
* toDateTimeTimeOrZero
* parseDateTimeBestEffort
* parseDateTimeBestEffortOrNull
* parseDateTimeBestEffortOrZero
Pick the one depending or your needs. Variants with 'or' don't throw exceptions on bad strings.
-22、获取日期周、月、季度第一天
toStartOfMonth()
toStartOfQuarter()
(toMonday(日期 + 1) - 1)