sql查询




select datediff(d,convert(varchar,dateadd(d,-90,'20151001'),112),'20150601')

select distinct datediff(MONTH,'1970-01-01',datenum) from #tpid

select month('20150801')

select convert(varchar,dateadd(d,-90,'20151001'),112)

select dateadd(dd,30,'2015-10-01')
select convert(varchar,dateadd(dd,30,'2015-10-01'),112)


select convert(varchar,'+@daybeg+',112) as datenum,pid,count(*) as pd from #dtpid where #dtpid.datenum>='+@day+' and #dtpid.datenum<convert(varchar,'+@daybeg+',112) group by pid


select * from LIUTKTemp.dbo.dtpid0 where datenum>convert(varchar,dateadd(d,-30,'20151010'),112)

你可能感兴趣的:(sql查询)