请问这个嵌套查询哪里错了?

Ouyangzm 2004-07-05 02:13:36
select @sTableName='tInOrder'
select @dBillDate='20040704'

exec('select count(*) from '+@sTableName+' where BillNo in
select BillNo from '+@sTableName+' where left(BillNo,8)='+@sBiLLNo)
请问这个嵌套查询哪里错了,应该如何写?
...全文
71 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
nhdj 2004-07-05
  • 打赏
  • 举报
回复
exec('select count(*) from '+@sTableName+' where BillNo in
(select BillNo from '+@sTableName+' where left(BillNo,8)='+@sBiLLNo+')')

select ... from .. where in (....) 你是不是少了in后面的()
maxtool 2004-07-05
  • 打赏
  • 举报
回复
表名不能用参数传进去
  • 打赏
  • 举报
回复
表名好像不能用参数

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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