You can use CASE statement.