Home » Java » Creating dynamic Query using SqlBuilder in java

Creating dynamic Query using SqlBuilder in java

Posted by: admin June 30, 2018 Leave a comment

Questions:

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….

Answers: