Is “Where IN” with multiple columns defined in Standard SQL?

前端 未结 4 1596
名媛妹妹
名媛妹妹 2020-12-17 16:33

I\'m working on a query like this:

SELECT * FROM requests where (id,langid) IN (SELECT nid,langid FROM node)

My questions are

  • does this
  • 4条回答
    •  猫巷女王i
      2020-12-17 17:27

      Your query would work in Postgres. Best I'm aware, not in MySQL.

      The portable version for DBs that would support it is:

      SELECT * FROM requests where ROW(id,langid) IN (SELECT nid,langid FROM node)
      

      (row is a reserved keyword since SQL:1999.)

      A more portable version will be to use exists() as suggested in the other answer.

    提交回复
    热议问题