Query:
select id_cliente,nm_cliente,tp_sexo from tb_clientes;
In my bank, sex is registered as int
would like when I make a select
displayed Male or Female instead of 1
or 2
, how do I do it?
Use case ... when :
select nm_cliente, case tp_sexo
when 1 then 'Masculino'
when 2 then 'feminino' end as strSexo
from tb_clientes
See an example working in SQLFIDDLE
References: