我想使用下面的mysql查询作为主查询中where子句的输入,但是我找不到正确的方法。是否有任何网站或例子,我可以使用,以学习如何做到这一点?
代码如下:
主要查询:
SELECT *, IF(SubQuery is true, 'Yes', 'No') AS Watched Distribution
FROM account
WHERE Watched Distribution LIKE 'Yes'
子查询:
SELECT account_id, IF(w.main_title RLIKE 'place holder for film
titels|nextfilm|nextfilm', 'Distribution', 'Non-distribution') AS Distribution
FROM watched w
WHERE Distribution LIKE 'Distribution'
1条答案
按热度按时间qhhrdooz1#
尝试使用join运算符和where子句,如下所示:
见下例:
https://www.sitepoint.com/community/t/mysql-question-how-to-us-an-as-field-in-the-where-clause/1188/5