Query with dynamic Column Name
Posted on 2009-05-16
I try to realize something like a query with dynamic column name. Something like that:
:conditions => ['state="online" and (sub_art="konferenz" or sub_art="kongress") and ? = 1', "b_" + params[:bereich]]
the result of the query is:
SELECT * FROM `veranstaltungen` WHERE (state="online" and (sub_art="konferenz" or sub_art="kongress") and 'b_inv' = 1) LIMIT 0, 10
As you can see, there the error is, that b_inv is in '', so the query does not work. Is there a way to fix it?