enrique_aeo
asked on
why DISTINCT it is not working
Por que no funciona el distinct
SELECT DISTINCT G.IDGERENCIA, GS.AREA
FROM TA_GASTOS_STAGE GS
INNER JOIN TA_GERENCIA G ON GS.GERENCIA_DIRECCIÓN = G.NOMBREGERENCIA
WHERE
GS.AREA LIKE '%Mantenimiento Palmas%'
ORDER BY G.IDGERENCIA,GS.AREA
IDGERENCIA AREA
1 11 Mantenimiento Palmas
2 11 Mantenimiento Palmas
this is the table_stage
SELECT *
FROM TA_GASTOS_STAGE GS
WHERE
GS.AREA LIKE '%Mantenimiento Palmas%'
TIPO CECO DESCRIPCION_CECO F4 GERENCIA_DIRECCIÓN AREA PLANTA RESPONSABLE F9 F10 F11 F12 F13 F14 F15 F16
1 Producción 10P30803 Soplado Palmas Supervisión Mantenimiento Gerencia Producción Soplado Mantenimiento Palmas Palmas
2 Producción 10P30804 Soplado Palmas Mantenimiento Gerencia Producción Soplado Mantenimiento Palmas Palmas
SELECT DISTINCT G.IDGERENCIA, GS.AREA
FROM TA_GASTOS_STAGE GS
INNER JOIN TA_GERENCIA G ON GS.GERENCIA_DIRECCIÓN = G.NOMBREGERENCIA
WHERE
GS.AREA LIKE '%Mantenimiento Palmas%'
ORDER BY G.IDGERENCIA,GS.AREA
IDGERENCIA AREA
1 11 Mantenimiento Palmas
2 11 Mantenimiento Palmas
this is the table_stage
SELECT *
FROM TA_GASTOS_STAGE GS
WHERE
GS.AREA LIKE '%Mantenimiento Palmas%'
TIPO CECO DESCRIPCION_CECO F4 GERENCIA_DIRECCIÓN AREA PLANTA RESPONSABLE F9 F10 F11 F12 F13 F14 F15 F16
1 Producción 10P30803 Soplado Palmas Supervisión Mantenimiento Gerencia Producción Soplado Mantenimiento Palmas Palmas
2 Producción 10P30804 Soplado Palmas Mantenimiento Gerencia Producción Soplado Mantenimiento Palmas Palmas
you probably have white space in the columns you can't see
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i agree
1 11 Mantenimiento Palmas 20
2 11 Mantenimiento Palmas 21
As I can do an UPDATE to remove blanks?
1 11 Mantenimiento Palmas 20
2 11 Mantenimiento Palmas 21
As I can do an UPDATE to remove blanks?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.