日期:2014-05-17  浏览次数:20941 次

谁帮我把这个MSSQL的写法改成ORACLE的写法。谢谢。。

select   test1.ps_id,test1.ps_name,test.time,test.tlevel   from   test1   left   join   test
on   test1.ps_id=test.ps_id
where   test.time   in
(
select   time   from
(
select   ps_id,
time=convert(char(10),dateadd(day,-min(datediff(day,time,getdate())),getdate()),120)  
from   test   group   by   ps_id
)a
)
order   by   tlevel   desc

------解决方案--------------------
datediff(day,time,getdate())-》
select sysdate-to_date(time, 'yyyy-mm-dd HH24:mm:ss ') from dual;

dateadd(day,1,getdate())->
select sysdate+1 from dual;

convert(char(10),times,120)->
to_char(times, 'yyyy-mm-dd ')

我想你是部分函数不知道吧,以上就是3个函数的oracle用法,你自己对sql语句稍加修改吧