Select all records don't meet certain conditions in a joined table

后端 未结 2 1817
慢半拍i
慢半拍i 2020-12-22 01:41

Let\'s say we have two tables here , posts and comments, the relations is one to many, there has a field call comment_date in the comments table.

Now I am struggle t

2条回答
  •  自闭症患者
    2020-12-22 02:28

    SELECT  *
    FROM    posts
    WHERE   post_id NOT IN 
            (
            SELECT  comment_post
            FROM    comments
            WHERE   comment_date >= @deadline
            )
    

提交回复
热议问题