I am trying to create a list of companies which appear in either of 2 other lists. I can manage to create a list of companies appearing in 1 other list like this :-
List masterList = Companies.createCriteria().list(){
'in'("companyname", alistofcompanies)
and {
or{
eq("type","T1")
eq("type","T2")
}
order ("companyname")
}
}
But I don't know how to look for companies in either of 2 other lists. I tried this :-
List masterList = Companies.createCriteria().list(){
or{
'in'("companyname", alistofcompanies)
'in'("companyname", anotherlistofcompanies)
}
and {
or{
eq("type","T1")
eq("type","T2")
}
order ("companyname")
}
}
but it gives me a syntax error.
Any clues how I should structure this?