where meetingID = [[WHERE IT MATCHES]] (select meetingID from meeting where categoryID = '1')
我不太确定在这里放什么来将这两者结合在一起?
如果一个类别可以有多个,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'
使用JOIN将提高性能。
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;