problem with DISTINCT SQL [closed]

-1

I have this query that shows me several records with the same name, I just want the Variable Name to appear only once for the repeated records, I know that it is with DISTINCT but it does not do anything

SELECT DISTINCT
        IDVariable
        , NombreVariable
        , TipoDato
        , NumeroDecimales
        , ValorFijo
        , Activo
    , ValorIdentificadorVariable
FROM
        VariablesFormula
    WHERE
        Activo = 1
AND
    ValorIdentificadorVariable='1'
    
asked by Ivxn 08.05.2018 в 23:36
source

1 answer

2

The distinct works like this:

select distinct NombreVariable from VariablesFormula

resultado: 
RegaliaAdicional
ParticipacionDelEstado
RA
BPO
select distinct NombreVariable, IDVariable from VariablesFormula

resultado
RegaliaAdicional, 1
RegaliaAdicional, 11

That is, for the combinations of columns that you select, it gives you as a result the records that are different

    
answered by 09.05.2018 в 00:36