Using conditional statements inside SQL

Original text of this message