I have a database that stores people jobs from present and past. So the database has a field listing the job as currently (A)ctive or (I)nactive. So it could look like this Mike H, Janitor, I Mike H, Programmer, I Mike H, CEO, A A need SQL that will use a parameter called Status_Indicator which will note what the person calling the SQL would like to retrieve. The parameter can have the following in it. '0' = Default Value if not specified in parameter file, will return all (Acive and Inactive) 'A' = Return only Active 'I' = Return only Inactive 'A','I' = Return Active and Inactive The code that I would like to use in the WHERE fails when testing a parameter with 'A','I'. Status_Indicator = '0' or JF.Status_Indicator in (Status_Indicator) and as 'Status_Indicator' = '0' or JF.Status_Indicator in (Status_Indicator) This is because the single quotes in the parameter mess up the expressions, but I need single quotes in the expression because the database uses a CHAR. Could anybody tell me a way to fix this and make it work?
If you have values enlcosed with single quotes then this should work JF.Status_Indicator in (Status_Indicator) (in MySQL). Which database server you are using? Can you post your full query?