in reply to Passing a value into a WHERE clause
You can't do that, nor would there be any benefit to it. If the SQL optimizer doesn't know what column you'll be qualifying in your where clause, it can't plan your query. You can use placeholders for the values you bind to columns, not the column names themselves.
If you could do that, by extension you'd end up with extreme examples like:
There's no point in trying to prepare a query like that: the optimizer doesn't know anything about what you're trying to do.$sth = $dbh->prepare(qq( select ? from ? where ? = ? group by ? order by ?));
HTH
|
|---|