I have got three fields
String stateID = "";
String districtID = "";
String talukaID = "";
These three fields can be empty Or can have value
The description of the table is
desc tbl_dealer
contactName
phone1
stateID
districtID
talukMandalID
Based on the values recivied , i have to write an SQL Query dynamically
Based on the values recivied , i have to write an SQL Query dynamically
For example
if all three are empty
select contactName , phone1 from tbl_dealer
If stateID is empty then (removing state from the query)
select contactName , phone1 from tbl_dealer where districtID = "'+districtID+'" AND talukaID = "'+talukaID+'"
And similarly for all the cases
Could you please let me know how can to wrie this efficiently ,