Error with SQL statement using MySQL
Posted on 2011-04-22
I am attempting to use the below SQL statement. This is clearly not right but I am not sure how to correct it. Could some please show me my mistake?
SELECT * FROM details where SerialNo LIKE '%Blah%' AND ControllerSerialNo LIKE '%Blah%' AND (Address1 OR Address2 OR Address3 OR Address4 OR County LIKE '%Blah%' AND COUNTRY = 'England'
I am basically passing 4 strings from a form to a servlet, SerialNo, ControllerSerialNo, Address and Country. The problem resides in the Address part of the statement. I want to select entries that match the Address string sent to the servlet, in any of the 5 different columns in my database.
If I am unclear in my explanation please dont hesitate to ask me for more info.