Select rows which are not present in other table

后端 未结 4 2080
抹茶落季
抹茶落季 2020-11-21 07:47

I\'ve got two postgresql tables:

table name     column names
-----------    ------------------------
login_log             


        
4条回答
  •  北恋
    北恋 (楼主)
    2020-11-21 08:08

    A.) The command is NOT EXISTS, you're missing the 'S'.

    B.) Use NOT IN instead

    SELECT ip 
      FROM login_log 
      WHERE ip NOT IN (
        SELECT ip
        FROM ip_location
      )
    ;
    

提交回复
热议问题