I am trying to import some table data into an Excel 2016 worksheet from an Oracle db using an ODBC connection. However, I do not want duplicate row entries in a specific column. When I try to use the Select DISTINCT function, I am getting an error message.
Here is the column I am trying to NOT import duplicate entries from.
EQP_CODE
C0Z9960SM
C0Z9960SM
C0Z9960SM
C0ZZX20SA
C0ZZX20SA
C0ZZX20SB
C0ZZX20SC
Here is the code throwing the error. If I replace `DISTINCT EQP_CODE with the * symbol then the code works. But I get the duplicate entries that I do not want.
Odbc.Query("dsn=METS Oracle ODBC UA Connection", "SELECT DISTINCT EQP_CODE
FROM TEQP#(lf)WHERE(TEQP.EQP_TYPE Like 'CT' and TEQP.SITE >0 and TEQP.EQP_USER2 <>' ' and TEQP.EQP_CODE <>' ')
ORDER BY TEQP.EQP_TYPE")
My expected results should be..
EQP_CODE
C0Z9960SM
C0ZZX20SA
C0ZZX20SB
C0ZZX20SC
EQP_CO
when you meantEQP_CODE
?