Inline if-then-else in MySQL queries

Posted . Visible to the public.

It can be useful to have a Ruby expression like condition ? positive_case : negative_case in MySQL queries:

UPDATE users SET monthly_debit = IF(subscriber, 19, 0)
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2010-09-30 16:25)