我对SQL很新,所以如果我写完全废话,请保持温和。我有一个phpbb数据库,我需要从特定用户获取topic_track中所有主题的post_topic和post_text。我的不成功查询(再次,基本上不了解SQL)如下:
SELECT post_subject, post_text
FROM phpbb_posts
WHERE topic_id=(ALL topic_id from phpbb_topics_track where user_id='165261')
你能帮我解决一下吗?
非常感谢你!
答案 0 :(得分:1)
那将是
SELECT post_subject, post_text
FROM phpbb_posts
WHERE topic_id = ANY (select topic_id from phpbb_topics_track where user_id='165261');
或
SELECT post_subject, post_text
FROM phpbb_posts
WHERE topic_id IN (select topic_id from phpbb_topics_track where user_id='165261');