in reply to Prepared query not accepting || instruction at execution

Using placeholders, mysql is going to compare the field to the text provided for the placeholder. In your case, "('Y' || 'N')". Have you any rows in that table with that text in the workrelated field?

--- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';

Replies are listed 'Best First'.
Re: Re: Prepared query not accepting || instruction at execution
by jpfarmer (Pilgrim) on Dec 28, 2002 at 16:02 UTC
    No, just 'Y' or 'N'. I'm trying to select fields that match either 'Y' or 'N'.

      In that case you will need two placeholders: one for the 'Y' and one for the 'N'.

      Using placehodlers will do all the quoting internally for you. This means that your filterstring will be quoted in such a way that it is no longer a boolean operation but a single string to be matched against. Hence, the empty recordset as a result.

      If for reasons internally to the logic of your program, you need the filterstring to be modifiable (e.g. sometimes 'OR' or 'AND' or more or less arguments, ...) then the only solution is to put the SQL string together yourself and not rely on placeholders.

      CountZero

      "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law