1
I would like to place a temporary column that was generated only in the query that will be linked to CD_NIVEL
say, "If CD_NIVEL = 5
creates a column 'Exclui'
as if it were a description of what the 5 means, I searched here and I found nothing I am new and I am learning SQL.
SQL code:
select a.cd_usuario
, (select nm_usuario from adm_usuario where cd_usuario=a.cd_usuario and cd_empresa=a.cd_empresa) as ds_usuario
, (select cd_funcionario from adm_usuario where cd_usuario=a.cd_usuario and cd_empresa=a.cd_empresa) as ds_funcionario
, a.cd_empresa
, a.cd_componente
, a.cd_nivel
from ADM_USUCMPEMP a
where cd_nivel=5
and (select tp_privilegio from adm_usuario where cd_usuario=a.cd_usuario and cd_empresa=a.cd_empresa)='1'
and (select tp_bloqueio from adm_usuario where cd_usuario=a.cd_usuario and cd_empresa=a.cd_empresa)=0
--and a.cd_usuario=6029
and a.cd_empresa=90
--and a.cd_componente like '%FISR031%'
order by 5