晕死,一个SQL语句在ASP下就是不能执行,谁能帮我解决?!!!

starsword 2002-11-09 03:50:36
select distinct spbh from dqkc where bmmc='总库房' and spbh not in (select distinct spbh from spdb where dcbm='总库房' and shr is not null and fhrq between '200210250000' and '200211092359') and spbh not in (select distinct spbh from spys where shr is not null and ysrq between '200210250000' and '200211092359')

<查找在后两个SELECT结果集中均不存在的结果集>
就是这个语句,在SYBASE数据库上可以执行,可是写在ASP里就出错,晕死,谁能帮我解决?救救我吧!!!!!!!!!
...全文
37 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lgs6715 2002-11-09
  • 打赏
  • 举报
回复
最简单方法,到数据库SSQL\\

TUA=t


tu\\\\dddd 调试就行了 ,SQLDDDDD
tonnycncn 2002-11-09
  • 打赏
  • 举报
回复
当然是空集了,你再想想这个逻辑吧。
starsword 2002-11-09
  • 打赏
  • 举报
回复
我分解过了:
select distinct spbh from dqkc where bmmc='总库房'
①结果 1 2 3 4

select distinct spbh from spdb where dcbm='总库房' and shr is not null and fhrq between '200210250000' and '200211092359'
②结果 1 2 3 4

select distinct spbh from spys where shr is not null and ysrq between '200210250000' and '200211092359'
③结果 1 2 3 4

然后合起来运行:
select ① where not in select ② and not in select ③
①-②-③

在数据库中执行得到 空集
可是在ASP里执行居然得到 2 3

我的代码都是把ASP里的直接复制到数据库中执行的,可是怎么会这样?
救命啊!救命啊!救命啊!救命啊!救命啊!救命啊!救命啊!救命啊!




tonnycncn 2002-11-09
  • 打赏
  • 举报
回复
将语句分解测试
tmj 2002-11-09
  • 打赏
  • 举报
回复
在內層你不要試一試 distinct
starsword 2002-11-09
  • 打赏
  • 举报
回复
不是别的地方的错,都可以运行,可是查询结果居然跟复制到SYBASE数据库下查询的结果不一样,我是想问一下,这种错误的原因是不是ASP不支持还是怎么回事?有什么解决办法没有?
baisun 2002-11-09
  • 打赏
  • 举报
回复
是不是你的别的语句有错?

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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