FW_DbfSqlQuery GROUP BY no funciona

Post Reply
User avatar
VictorCasajuana
Posts: 268
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs
Contact:

FW_DbfSqlQuery GROUP BY no funciona

Post by VictorCasajuana »

Hola.
Estoy intentando hacer una consulta simple con la función FW_DBFSqlQuery pero cuando le añado GROUP BY me muestra error.

La consulta es la siguiente:

Code: Select all | Expand

Function Main()

   TEXT INTO cQuery
      SELECT CODIGO, NOMBRE, COD_PRO 
      FROM ARTICULO
      GROUP BY COD_PRO
   ENDTEXT
   oRs := FW_DbfSqlQuery( '.\DBF\', cQuery,,.t.)
   xBrowse( oRs)

Return ( Nil )
la respuesta que obtengo es:
Image

en cambio, en MySql sí que funciona:
Image

si le quito GROUP BY
funciona correctamente
Image

alguna idea?

He buscado la documentación de FW_DbfSqlQuery() pero no la encuentro.

Gracias!!
--------
¿ Y porque no ?
¿ And why not ?
User avatar
VictorCasajuana
Posts: 268
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs
Contact:

Re: FW_DbfSqlQuery GROUP BY no funciona

Post by VictorCasajuana »

Thank's karniha
Before writing this post I have reviewed the forum content about fw_dbfSqlQuery() but I have not found any answer to my problem.
--------
¿ Y porque no ?
¿ And why not ?
User avatar
nageswaragunupudi
Posts: 10691
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FW_DbfSqlQuery GROUP BY no funciona

Post by nageswaragunupudi »

Syntax of SQL Query has nothing to do with FWH function.
It is for the programmer to know the correct syntax of SQL supported by Jet OLE/ACE ole

Normally GROUP BY clause is used for Aggregate functions.
Example:

Code: Select all | Expand

SELECT STATE,SALARY FROM CUSTOMER GROUP BY STATE ORDER BY STATE
Some Databases like MySql support GROUP BY without aggregate functions.
But all providers /databases do NOT support GROUP BY clause without Aggregate functions like MSSQL.ORACLE, Jet,ACE, etc

While dealing with DBF, we are concerned with Jet Oledb/ACE Oledb/VFPOLEDB.
None of them support GROUP BY clause without Aggregate functions.

It is rare to find anyone using GROUP BY clause if not for finding GROUPED TOTALS/AVERAGES. ETC
Regards

G. N. Rao.
Hyderabad, India
User avatar
VictorCasajuana
Posts: 268
Joined: Wed Mar 28, 2018 4:38 pm
Location: Vinaròs
Contact:

Re: FW_DbfSqlQuery GROUP BY no funciona

Post by VictorCasajuana »

Thanks for your reply.
Indeed, I have seen that the problem is the SQL syntax. I am very used to using MySql for web purposes. Now it's time to learn MSSQL to be able to advance in FiveWin Harbour.
--------
¿ Y porque no ?
¿ And why not ?
Post Reply