PROBLEM WHEN USING ORDE BY DESC field IN AN XBROWSE

PROBLEM WHEN USING ORDE BY DESC field IN AN XBROWSE

Postby joseluisysturiz » Wed Aug 02, 2017 3:10 pm

Google translator:

Regards, I have this problem for a long time and I solved it by not using the DESC clause in ORDER BY of a MySql query, but unfortunately right now it is mandatory, I use an xBrowse with TDolphin that contains a query with 3 tables related to LEFT JOIN, until But when I use the xBrowse and click on the heads containing the fields for which I make the LEFT JOIN, then I get this error message "Error MYSQL / 1052 Column 'id_provee' in order clause is ambiguous", in The other columns does the ordering without problems, now if I remove the DESC of the query, everything works well in all the columns, nor idea of how to solve this problem. I leave the code used, from now, thanks for the suggestions and answers, greetings ... thanks ...: shock:

CONSULTA MYSQL / TDolphin
Code: Select all  Expand view  RUN

cSql := "SELECT cm.id_provee, pv.provee_nombres, cm.com_num_fac, "
   cSql += "cm.com_fch_fac, cm.com_peso_kilo, cm.com_unidades "

   cSql += "FROM ge_pollos_compras_master AS cm "

   cSql += "LEFT JOIN ge_pollos_compras_detalles AS cd ON cm.id_provee = cd.id_provee "
   cSql += "AND cm.com_num_fac = cd.com_num_fac "
   cSql += "LEFT JOIN ge_provee_master AS pv ON cm.id_provee = pv.id_provee "

   cSql += "GROUP BY cm.id_compra_mas "

   cSql += "ORDER BY cm.com_fch_fac DESC" // SI QUITO "DESC" TRABAJA TODO BIEN
 


XBrowse / TDolphin
Code: Select all  Expand view  RUN

REDEFINE XBROWSE aBrw[2] ID 100 OF oFldx:aDialogs[2] ;
   DATASOURCE oQryComPro ;
   LINES CELL AUTOSORT AUTOCOLS ;
   HEADERS "Cod.", "Nombre Proveedores", "Factura", "Fecha", "Kilos Compra" ,;
      "Cant.Piezas";
   COLUMNS "id_provee", "provee_nombres", "com_num_fac", "com_fch_fac" ,;
      "com_peso_kilo", "com_unidades" ;
   COLSIZES 50, 200, 50, 70, 80, 80 ;
   JUSTIFY 2, , 2, 2 ;
   PICTURES , , , , oPi:nKg1, oPi:nPi5
 
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: PROBLEM WHEN USING ORDE BY DESC field IN AN XBROWSE

Postby nageswaragunupudi » Wed Aug 09, 2017 1:32 pm

FWMARIADB
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10663
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 57 guests