数据库计算日期,统计系统时间(月)的数据
数据库计算日期,统计系统时间(月)的数据
计算出本月第一天到最后一天的日期:
www.2cto.com
select date(rtrim(char(year(min(start_time))))||'-'||rtrim(char(month(min(start_time))))||'-1') as startTime,
date(rtrim(char(year(max(start_time))))||'-'||rtrim(char(month(max(start_time)+1 month)))||'-1') as endTime from table_A t;
统计本月数据:
select sum(MONTHLY_REPAYMENTS) as totle from TABLE_A where ID='123'
AND date('2012-11-01') < date(current timestamp ) and date('2012-12-01') > date(current timestamp)
本站文章为和通数据库网友分享或者投稿,欢迎任何形式的转载,但请务必注明出处.
同时文章内容如有侵犯了您的权益,请联系QQ:970679559,我们会在尽快处理。