虚位以待(AD)
虚位以待(AD)
首页 > 数据库 > DB2数据库 > 数据库计算日期,统计系统时间(月)的数据

数据库计算日期,统计系统时间(月)的数据
类别:DB2数据库   作者:码皇   来源:互联网   点击:

数据库计算日期,统计系统时间(月)的数据计算出本月第一天到最后一天的日期: www 2cto com select date(rtrim(char(year(min(start_time))))||& 39;-& 39;||rtrim(char(month(min(start_time))))||& 39;-1

数据库计算日期,统计系统时间(月)的数据   计算出本月第一天到最后一天的日期:   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)  
相关热词搜索: 数据库 计算 日期