7
3

More than 5 years have passed since last update.

DOMAで複数列のIN句(列:条件 = n:n)を実装する。

Posted at

複数列のIN句???

こんなの

SELECT * FROM TEST_TBL
WHERE
    (FIRST_NAME, LAST_NAME) IN (
        ('山田', '太郎'),
        ('鈴木', '次郎')
    )

DOMAで実装

普通にやるとダメなのでfor文で頑張る。

SELECT * FROM TEST_TBL
WHERE
    (FIRST_NAME, LAST_NAME) IN (
        /*%for condition : conditionList */
            (/* condition.firstName */'firstname', /* condition.lastName */'lastname')
            /*%if condition_has_next */
                ,
            /*%end */
        /*%end */
        /*%if conditionList == null || conditionList.isEmpty() */
            (NULL, NULL)
        /*%end */
    )
7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3