How to do an SE function in SQL

0

Good morning.

How do I make an SE function in SQL server? For example, I have data in a column and when it is = '1';'masculino';'feminino' .

Can you help me out?

    
asked by anonymous 14.06.2018 / 16:47

1 answer

1

In this case, you should ideally use CASE , since the return depends on the validation of the data of a specific field:

SELECT CASE WHEN campo_genero = '1' THEN 'Masculino' ELSE 'Feminino' END
FROM nome_tabela
    
14.06.2018 / 16:54