Is there a 'not in' equivalent in GORM?

前端 未结 5 954
我寻月下人不归
我寻月下人不归 2021-02-15 10:21

Is this possible to convert in createCriteria()?

SELECT * FROM node WHERE (node.type = \'act\' AND nid NOT IN (SELECT nid FROM snbr_act_community)) LIMIT 10
         


        
5条回答
  •  失恋的感觉
    2021-02-15 10:54

    According to Grails documentation about creating criteria here, you can use something like this:

    not {'in'("age",[18..65])}
    

    In this example, you have a property named "age" and you want to get rows that are NOT between 18 and 65. Of course, the [18..65] part can be substituted with any list of values or range you need.

提交回复
热议问题