SQL语句

 

 

 

 

/*抄牌管理:CS_QW_TIEDANSB*/
select * from CS_QW_TIEDANSB where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by uptime desc

/*拖车业务:CS_QW_TUOCHESB*/
select * from CS_QW_TUOCHESB where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by time desc

/*现场纠处:CS_QW_XCJIUCHUSB*/
select * from CS_QW_XCJIUCHUSB where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by time desc

/*当场处罚:CS_QW_XCCHUFASB*/
select * from CS_QW_XCCHUFASB where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by uptime desc

/*问题上报:CS_QW_wentiSB*/
select * from CS_QW_wentiSB where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by updatetime desc

/*路面勤务:CS_QW_LUMIANQWSB*/
select * from CS_QW_LUMIANQWSB where duiyuanguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by time desc


/*图片上报:CS_QW_XIANCHANGQZ*/
select * from CS_QW_XIANCHANGQZ where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by sbtime desc

/*商户信息采集:CS_QW_SHANGHUSB*/
select * from CS_QW_SHANGHUSB where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by sztime desc

/*商户日常管理上报:CS_QW_SHANGHUCHECKINFO*/
select * from CS_QW_SHANGHUCHECKINFO where personguid ='1c7454cc-d6d0-4122-9b3f-d4cb993ebe9d' order by sbr_date desc









/*按照时间段查询*/
select * from TableA where to_char(startDate,'YYYY-MM-DD')>='2011-09-01' and  to_char(endDate,'YYYY-MM-DD')<='2011-09-012' ;

select * from cs_qw_wentisb where updatetime(startDate,'YYYY-MM-DD')>='2012-03-17' 
and  updatetime(endDate,'YYYY-MM-DD')<='2012-03-17' ;

select * from cs_qw_wentisb
 where updatetime
between to_date('2012-03-17','yyyy-mm-dd hh24:mi:ss') 
and to_date('2012-03-19','yyyy-mm-dd hh24:mi:ss') 

//同一天
select * from cs_qw_wentisb
 where 
 updatetime >= to_date('2012-03-18','yyyy-mm-dd hh24:mi:ss') 
 
 select * from cs_qw_wentisb
 where 
 updatetime >=to_date('2012-03-10','yyyy-mm-dd hh24:mi:ss') 
 and 
 updatetime <=to_date('2012-03-19 23:59:59 999','yyyy-mm-dd hh24:mi:ss') 
select * from cs_qw_wentisb order by updatetime desc
select * from cs_qw_wentisb where updatetime >= convert(datetime,'2012-03-17', yyyy-mm-dd)  and updatetime <=covert(datetime,'2012-03-19',yyyy-mm-dd)


select * from cs_qw_wentisb where updatetime between date'2012-03-17' and date'2012-03-19'


select count(*) from cs_qw_wentisb where  to_char(updatetime,'yyyy-mm-dd hh24:mi:ss')>='2012-03-19 00:00:00' and to_char(updatetime,'yyyy-mm-dd hh24:mi:ss')<='2012-03-19 23:59:59'


select * from cs_qw_wentisb where to_char(updatetime,'yyyy-mm-dd hh24:mi:ss')>='2012-3-19 00:00:00' 
and to_char(updatetime,'yyyy-mm-dd hh24:mi:ss')<='2012-3-19 23:59:59'
 

你可能感兴趣的:(sql语句)