易截截图软件、单文件、免安装、纯绿色、仅160KB

把一个oracle查询语句改成SQL的

select CanSell,Signed,Records,AveragePrice,housetype,addtime from AC_SellExhilarant where (floor(sysdate - addtime) =1 or floor(sysdate - addtime) = 0) and DISTRICT = :DISTRICT order by decode(Housetype,'住宅类',0,'商业类',1,'办公类',2),AddTime DESC

请问各位高手这个怎么改
SQL code:
select CanSell,Signed,Records,AveragePrice,housetype,addtime,
case when Housetype = '住宅类' then 0
when Housetype = '商业类' then 1
when Housetype = '办公类' then 2
end rn
from AC_SellExhilarant
where (floor(sysdate - addtime) = 1 or floor(sysdate - addtime) = 0)
and DISTRICT = :DISTRICT
order by rn, AddTime DESC;


floor向下取整这个函数标准sql中不确定是否能用或者有相似的函数

查了下,floor是标准sql数学函数,可以使用,但是获取当前时间,sqlserver,mysql,oracle,db2,informix都有各自不同的函数。
SQL code:
select CanSell,Signed,Records,AveragePrice,housetype,addtime,
from AC_SellExhilarant
where (floor(sysdate - addtime) = 1 or floor(sysdate - addtime) = 0)
and DISTRICT = :DISTRICT
order by case when Housetype = '住宅类' then 0
when Housetype = '商业类' then 1
when Housetype = '办公类' then 2
end


相关问答:

救命啊!!JSP连接SQL2000问题!

各位大侠救命啊 !!
刚装了SQL2000 sp3
想用JSP连接数据库但是出现问题了
我用的是JDK6.0+tomcat5.0+SQL2000 SP3+JDBC sp3
它显示的是
javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver fo ......

急问一个oracle字段设置的问题 - Oracle / 基础和管理

各大老师好,请教一个问题.
我设置了一个oracle字段,varchar(3000),然后插入一条数据长度才1000,就报错了.如:net.sf.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
Caused ......

oracle 10g web登陆EM的问题? - Oracle / 基础和管理

安装了Oracle 10g,默认安装了orcl数据库,这个数据库能不能删除啊,还有我如果新建了其他数据库,怎么知道在web中登陆不同数据库的地址啊?

1
可以删除
2
在WEB地址栏中输入地址的时候指定新创建的数据库的IP ......

Oracle 数据导出问题 - Oracle / 高级技术

exp user/password@dbname file=c:\table.dmp tables=jbitaku,jbitakum grants=y
然後按回車鍵 說明:  user/password@dbname  分別表示用戶名,密碼和服務名 f ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号