can you help me for creating sql query in where condition
SELECT * FROM classicmodels.offices t1 INNER JOIN classicmodels.employees t0
ON (t1.officeCode = t0.officeCode) INNER JOIN classicmodels.customers t2 ON
( (t0.employeeNumber = t2.salesRepEmployeeNumber) OR (t0.firstName =
t2.contactFirstName) ) WHERE (t2.creditLimit > 70000) AND (t2.creditLimit <
100000) OR (t0.officeCode = 6)
ORDER BY
t0.firstName ASC
I am not able to create please tell me how to create AND or OR both condition in single query
WHERE (t2.creditLimit > 70000) AND (t2.creditLimit < 100000) OR (t0.officeCode = 6)
How can create dynamic query may more then one time AND condition or may be more then one time OR condition. it's condition comes random. then i want to create query. can you help me....
I'm not sure if "SqlBuilder" is a specific library, because there are several libraries that have a
SqlBuilder
class (e.g. MyBatis), and there are other libraries that are SQL builders (e.g. jOOQ). So, I'm just going to answer this for jOOQ (I work for the vendor).Using jOOQ
Your query could be written as such, assuming you're using the code generator:
Using some other, specific SqlBuilder
If your specific SqlBuilder cannot handle the type of predicate you've written, perhaps you can rewrite it as such: