嵌套查询-ADO+DELPHI+SQL SERVER

CDMAA 2003-03-18 05:54:17
只是一个简单的嵌套查询,为什么在ACCESS下数据库行,在SQL SERVER下不行?为什么,谁能给点提示!
select * from Table1 where ATime>=:t1 and BTime<=:t2
这个查询是成功的
接下的来就不对了
select count(*),sum(MYMONEY) from(select * from Table1 where ATime>=:t1 and BTime<=:t2
) where TypeOP=:t100
报错!Incorrect syntax near the keyword where
但是用ACCESS中就可以的,为什么,不知道那位兄弟是否也有同样的经历!
...全文
81 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
CDMAA 2003-03-18
  • 打赏
  • 举报
回复
还是不行呀,是为什么,有谁帮我看一下吧!
gzllich 2003-03-18
  • 打赏
  • 举报
回复
select count(*),sum(MYMONEY) from(select * from Table1 where ATime>=:t1 and BTime<=:t2
) as t1 where TypeOP=:t100
Wally_wu 2003-03-18
  • 打赏
  • 举报
回复
同意 heixiu1980(heixiu1980) :


select count(*),sum(MYMONEY) from(select * from Table1 where ATime>=:t1 and BTime<=:t2) a
where TypeOP=:t100
heixiu1980 2003-03-18
  • 打赏
  • 举报
回复
select count(*),sum(MYMONEY) from(select * from Table1 where ATime>=:t1 and BTime<=:t2
) a
where TypeOP=:t100

加个a应该就可以了
bluemeteor 2003-03-18
  • 打赏
  • 举报
回复
select count(*),sum(MYMONEY) from(select * from Table1 where ATime>=:t1 and BTime<=:t2 and TypeOP=:t100
)

TypeOP=:t100把这个放到里面

2,497

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧