sql

统计相反条件的数量

select m.mf_id, count(case when `is_complete` = 0 then 1 else null end), count(case when `is_complete` = 1 then 1 else null end) from manifest m inner join task t on t.mf_id = m.mf_id where t.is_complete = 0 group by m.mf_id


sqlite将毫秒时间戳转为日期

SELECT date(1469528510300/1000, 'unixepoch', 'localtime');
[color=red]2016-07-26[/color]

将时间戳格式化成年月日

select * from task group by strftime('%Y%m%d ', datetime(end_time/1000, 'unixepoch'))
[color=red]20160905 [/color]


将标准时间戳转为本地格式的时间

strftime('%Y%m%d %H:%M:%S', datetime(end_time/1000, 'unixepoch'), 'localtime')

SELECT strftime('%Y%m%d %H:%M:%S', datetime(end_time/1000, 'unixepoch'), 'localtime') as t_date, t.uid, t.task_name, t.task_desc, m.uid, t.creator_id, t.executor_id, t.order_num, t.end_time, t.is_star, t.create_time, t.is_exist_attach,
t.is_exist_comment, m.mf_name FROM manifest m INNER JOIN task t ON m.mf_id = t.mf_id where 1 = 1 and t.is_deleted = 0 and t.is_complete = 0
and t.end_time > 1473465600000 and t.end_time < 1533945600000 and t.order_num > 0

[color=red]20160912 13:20:20[/color]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值