开发者

Groovy FindAll statement for finding values that don't exist

I am trying to construct a Groovy statement to find values that don't exist in a pre-populated list.

I'm using SQL and think I want to do something like :

myList = [a, b, c, d, e ... lots more data]

sql.findAll("SELECT * FROM table WHERE code not in " + <myList>)  

I have a feeling this is very simple .. I'm just not sure how to开发者_StackOverflow construct the closure.

Also open for any other suggestions on how to do it ..

Thanks for any insight ..


The value of myList in the sql statement should be a comma separated list of values. You eventually want your query to look like

SELECT * FROM table WHERE code not in ('a','b','c','d','e',...lots more)

Have you tried something like this?

sql.findAll("SELECT * FROM table WHERE code not in ('" + myList.join("','") + "')")
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜