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

前端 未结 4 1611
名媛妹妹
名媛妹妹 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条回答
    •  北荒
      北荒 (楼主)
      2020-12-17 17:13

      I checked that with PostgreSQL and it works (it is officially supported), but it's your responsibility to make id ↔ nid and langid ↔ langid column types compatible (or use explicit casting).

      I think it is pretty standard construct. I have SQL:2003 draft and there is in predicate defined (as well as mentioned exists predicate).

      8.4

      Function

      Specify a quantified comparison.

      Format

       ::=  
       ::= [ NOT ] IN 
       ::=
      
      | ... (rest is not important here)
      

      EDIT:

      As checked works well under MySQL too (version 5.0.90-log). Here is documentation link.

      提交回复
      热议问题