时间:2021-07-01 10:21:17 帮助过:21人阅读
4.这个是有个分类表,有个账单表,根据分类中的子分类分类统计再排序:
select sum(price),consumetype.title from mybill "
+ "left join consumetype on mybill.typeid =consumetype.id "
+ "group by mybill.typeid order by sum(price) desc";
5.根据时间来比较选择:
select * from MyBill where createTime < datetime(‘2015-05-19‘)
相应的其他时间函数方式如下:
* select datetime(‘now‘);
* select datetime(‘2006-10-17 00:20:00‘,‘+1 hour‘,‘-12 minute‘);
* select date(‘2006-10-17‘,‘+1 day‘,‘+1 year‘);
* select datetime(‘now‘,‘start of year‘);
* select datetime(‘now‘,‘start of month‘);
* select datetime(‘now‘,‘start of day‘);
* select datetime(‘now‘,‘+10 hour‘,‘start of day‘,‘+10 hour‘);
* select datetime(‘now‘,‘localtime‘);
* select datetime(‘now‘,‘+8 hour‘);
sqlit中使用到的查询语句
标签:连表查询 sqlite时间函数 sqlite时间比较 left join