Hi All,

I 'm trying to figure out how to solve this, and I didn't find any post 
related. Let's see if I can explain good:

I have the following code:

//Select count from a table
SelectQuery query = DSL. 

                    selectCount().

                    from(TABLE).getQuery();


//If we need to filter by type, add an AND condition for it
if (criteria.filterByType()) {

query.addConditions(CONTACT_TYPE.in(type));

}

//Now, I need to add other OR conditions grouped:
if(criteria.filterByName()){

//What should I do here?

}
if(criteria.filterByAge()){

//What should I do here?

}


So, I want to do something like:
SELECT COUNT(*)
FROM TABLE
WHERE CONTACT_TYPE = type
AND ( NAME = name OR AGE = age )

How do I add those grouped OR conditions dynamically between ( ) ?

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to