Execute Query DISTINCT

QuestionsExecute Query DISTINCT
Samuel Gil asked 5 months ago

Hi

 

 

im trying to execute this query

 

SELECT DISTINCT (A.ID, A.ID_MODELO,D.ID_GEN, B.MODELO, F.TEAM,I.CALIDAD1 + ‘;’ + I.CALIDAD2 + ‘;’ + I.CALIDAD3 AS CALIDADES, H.NOMBRE AS PROVEEDOR, J.SECCION AS SECCION,K.FAM_DIS AS FAMILIA, L.SUBFAM_DIS AS SUBFAMILIA, M.NAME + ‘ ‘ + M.SURNAME AS COMPRAODRA )
FROM PLM_COTIZACIONES A
LEFT JOIN V_MODELOS_COMPLETO_V7 B ONA.ID_MODELO=B.ID_MODELO
LEFT JOIN GC_MODELOS C ONB.ID_MODELO=C.ID_MODELO
LEFT JOIN GC_GENERICO D ONC.ID_GEN=D.ID_GEN
LEFT JOIN PLM_TEMPORADAS E ONE.ID_TEMPORADA=D.ID_TEMPORADAANDE.ID_ANO=D.ID_ANO
LEFT JOIN tblTEAMS F ON F.ID_TEMP = D.ID_TEMPORADA AND F.ID_ANO = D.ID_ANO AND C.ID_TEAM = F.ID_TEAM
LEFT JOIN PLM_ASIGNAR_COMPRADORA G ONG.ID_MODELO=A.ID_MODELO
LEFT JOIN PLM_PROVEEDORES H ONH.ID_PROVEEDOR=A.ID_PROVEEDOR
LEFT JOIN PLM_CALIDADES_V2 I ONI.ID_GEN=D.ID_GEN
LEFT JOIN tblSECCIONES J ON D.ID_SECCION = J.ID_SECCION
LEFT JOIN tblFAMILIAS K ON K.ID_FAMILIA = D.ID_FAMILIA
LEFT JOIN tblSUBFAMILIAS L ON L.ID_FAMILIA = K.ID_FAMILIA
LEFT JOIN PLM_LOGIN M ON M.ID_LOGIN = G.ID_COMPRADORA
WHERE B.ID_MODELO IS NOT NULL AND D.ID_STATUS != 5

 

it throw me a sintax error near DISTINCT, HERE YOU CAN SEE

(pdo): select top (1+0) DISTINCT (A.ID, A.ID_MODELO,D.ID_GEN, B.MODELO, F.TEAM,I.CALIDAD1 + ‘;’ + I.CALIDAD2 + ‘;’ + I.CALIDAD3 AS CALIDADES, H.NOMBRE AS PROVEEDOR, J.SECCION AS SECCION,K.FAM_DIS AS FAMILIA, L.SUBFAM_DIS AS SUBFAMILIA, M.NAME + ‘ ‘ + M.SURNAME AS COMPRAODRA ) FROM PLM_COTIZACIONES A LEFT JOIN V_MODELOS_COMPLETO_V7 B ON A.ID_MODELO = B.ID_MODELO LEFT JOIN GC_MODELOS C ON B.ID_MODELO = C.ID_MODELO LEFT JOIN GC_GENERICO D ON C.ID_GEN = D.ID_GEN LEFT JOIN PLM_TEMPORADAS E ON E.ID_TEMPORADA = D.ID_TEMPORADA AND E.ID_ANO = D.ID_ANO LEFT JOIN tblTEAMS F ON F.ID_TEMP = D.ID_TEMPORADA AND F.ID_ANO = D.ID_ANO AND C.ID_TEAM = F.ID_TEAM LEFT JOIN PLM_ASIGNAR_COMPRADORA G ON G.ID_MODELO = A.ID_MODELO LEFT JOIN PLM_PROVEEDORES H ON H.ID_PROVEEDOR = A.ID_PROVEEDOR LEFT JOIN PLM_CALIDADES_V2 I ON I.ID_GEN = D.ID_GEN LEFT JOIN tblSECCIONES J ON D.ID_SECCION = J.ID_SECCION LEFT JOIN tblFAMILIAS K ON K.ID_FAMILIA = D.ID_FAMILIA LEFT JOIN tblSUBFAMILIAS L ON L.ID_FAMILIA = K.ID_FAMILIA LEFT JOIN PLM_LOGIN M ON M.ID_LOGIN = G.ID_COMPRADORA WHERE B.ID_MODELO IS NOT NULL AND D.ID_STATUS != 5 AND E.ID = ’19’

Fatal error: Uncaught PDOException: SQLSTATE[42000]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near the keyword ‘DISTINCT’. in E:\PRODUCTO\vendor\gridphp\lib\inc\adodb\drivers\adodb-pdo.inc.php on line 603 PDOException: SQLSTATE[42000]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near the keyword ‘DISTINCT’. in E:\PRODUCTO\vendor\gridphp\lib\inc\adodb\drivers\adodb-pdo.inc.php on line 603 Call Stack: 0.0007 520672 1. {main}() E:\PRODUCTO\recotizacion_masiva_grid.php:0 0.0351 2759056 2. jqgrid->render($grid_id = ‘list1’, $dialog = ???) E:\PRODUCTO\recotizacion_masiva_grid.php:123 0.0579 5430224 3

it is adding “top(1+0)”

 

Can you help me?

 

 

thanks.

 

1 Answers
Abu Ghufran Staff answered 5 months ago

I’ve emailed you latest build which should solve this issue.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

8 + 4 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?