where meetingID = [[WHERE IT MATCHES]] (select meetingID from meeting where categoryID = '1')
我不太清楚要把这两个加在一起怎么样?
答案 0 :(得分:0)
如果某个类别可以包含多个meetingID
,则最好使用IN
而不是=
,这样就不会产生错误,
SELECT ...
FROM ....
where meetingID IN (select meetingID
from meeting
where categoryID = '1')
另一种方式是JOIN
他们,例如
SELECT DISTINCT a.*
FROM tableName a
INNER JOIN meeting b
ON a.meetingID = b.meetingID
WHERE b.categoryID = '1'
答案 1 :(得分:0)
使用加入会提高效果。
SELECT ...
FROM tablea a
INNER JOIN meeting m ON a.meetingID = m.meetingID AND m.categoryID = '1'
或
SELECT ...
FROM tablea a
INNER JOIN (SELECT meetingID
FROM meeting
WHERE categoryID = '1'
) b ON a.meetingID = b.meetingID;