select in 语句问题

daxiong521 2008-06-17 09:20:19
sql="Select id,sort,meno from user_sort where id exsist ( select sortID from users where username='"&UserName&"'"
这句语句运行提示
语法错误 (操作符丢失) 在查询表达式 'id exsist ( select sortID from users where username='abc'' 中。

把exsist改成in也是一样的!

数据库是用access,表user_sort的ID是自动编号,类型是长整型,表users中的sortID的类型是备注!不知是不是因为数据类型不一致造成的错误?
...全文
47 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jhwcd 2008-06-18
  • 打赏
  • 举报
回复
你的SQL写法是错误的。
也可以这样写。
sql="Select id,sort,meno from user_sort where id in (select sortID from users where username='"&UserName&"')"
NIKIA 2008-06-17
  • 打赏
  • 举报
回复
如果你要用exists则你的写法有误,请参照下面的试试:
Select id,sort,meno
From user_sort
WHERE EXISTS
(SELECT *
users
Where users.username='"&UserName&"'"
And user_sort.id = convert(users.sortID as int)
)


daxiong521 2008-06-17
  • 打赏
  • 举报
回复
以上是语句出错了!忘记了一个括号!

但是语句正确之后,又提示"
子查询 'sortID' 中 Memo 或 OLE 对象无效.
bfdeh 2008-06-17
  • 打赏
  • 举报
回复
少了半边括号?




回复内容太短了!没办法,再写点!

28,390

社区成员

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

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