我有三张桌子
tbl_Service
1)sId
2)Name
tbl_quatItem
1)iId
2)quat_ID
3)ser_Id
tbl_quat
1)qId
2)date
3)Name
我已尝试过以下声明
select s.*, q.*
from tbl_service s, tbl_quatItem q
where q.quatID = 1001
and s.sId not in q.qutID
现在,我想要从tbl_Service
和tbl_quatItem
quat_Id = qID
获取数据
答案 0 :(得分:0)
select * from tbl_Service where sId not in (select ser_Id from tbl_quat_ID where quat_Id != <qID>)
我希望从应用程序端传递qID ..你只需要附加字符串以传递适当的值