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

关于SqlDataSource控件嵌套with子句
SQL code
with newVal(val_type,val_price) as
  (select rp.roomtypeid, sum(rp.price)
  from room_price rp
  where rp.hotelno=1 and rp.thisdate between to_date('2012-07-30','yyyy-mm-dd') and to_date('2012-08-02','yyyy-mm-dd')
  group by rp.roomtypeid)
select room_type.roomtypename, val_price
from newVal, room_type
where room_type.roomtypeid = newVal.val_type


这个查询在命令行里可以查询出来,但是在SqlDataSource里面一直提示内部DbSqlParser失败!
各位大大有解决方法么。。

------解决方案--------------------
应该不是语句的问题。我类似的写法就完全没问题。
------解决方案--------------------
公用表达式 抱什么错 有详细错误信息么???
------解决方案--------------------
DbSqlParser失败,已经说了是转换失败,我猜可能是你SQL中的这个to_date函数执行有权限。
你是不是要筛选当前时间的前三天数据,可用datediff函数,datediff(day,rp.thisdate,getdate())>3