再问该sql语法怎么写

hanger1978 2003-12-08 10:52:05
cp表
id cmop
1 安全
2 质量
3 环保
address表
id name
1 王三
2 赵四
3 刘二
zh表
id addressid cpid
1 1 1,2,3
2 2 2,3
3 3 1,3
zh表是记录address表再cp表都有什么功能
现在我想知道,如果用cp表里得安全。我怎么筛选出哪个人有安全这个功能,SELECT怎么写,有人告诉我这么写
select * from address where id in(select yhid from zh where instr(',' + cast((select * from cp where comp='安全') as varchar(10)) + ',',',' + 'cpid' + ',')>0)可是,我这里却不好用,错误如下
ODBC 驱动程序不支持所需的属性。
/aqk/txl/list.asp,行20
后来说是用instr可是我不会写(因为我用的是access),不知道怎么用
...全文
30 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
yonghengdizhen 2003-12-08
  • 打赏
  • 举报
回复
select * from address where id in(select yhid from zh where instr(','+'cpid'+ ',' , ','+(select CStr(id) from cp where comp='安全')+',')>0)

不是已经给你发过短消息了吗?
yangyakun 2003-12-08
  • 打赏
  • 举报
回复
以下是我的个人建议
select *
from cd
where comp='安全'

28,407

社区成员

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

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