読者です 読者をやめる 読者になる 読者になる

この日記は私的なものであり所属会社の見解とは無関係です。 GitHub: takahashikzn

IN句とMEMBER OF句の違い

IN句

パラメータはリテラルまたはサブクエリーを指定可能。


OK

SELECT f FROM Foo AS f WHERE 
    f.id IN (1, 2, 3)


SELECT f FROM Foo AS f WHERE
    f.id IN (SELECT b.id FROM Bar AS b WHERE ...)


NG

SELECT f FROM Foo AS f, Bar AS b WHERE
    f.id IN b.foos

MEMBER OF句

プロパティのみ指定可能。


OK

SELECT f FROM Foo AS f, Bar AS b WHERE
    f.id MEMBER OF b.foos

SELECT f FROM Foo AS f, Bar AS b WHERE
    'abc' MEMBER OF b.bars


NG

SELECT f FROM Foo AS f WHERE 
    f.id MEMBER OF (1, 2, 3)


SELECT f FROM Foo AS f WHERE
    f MEMBER OF (SELECT b.foo FROM Bar AS b WHERE ...)