sql query

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dj_sherbu
Posts: 7
Joined: Tue 29 Apr 2008 12:13
Contact:

sql query

Post by dj_sherbu » Mon 12 May 2008 09:23

i am trying to extract some data from a table and rank the records found, but the code i am trying to use is not allowed in TMyQuery though it works in standard sql query. here is the piece of code:

Code: Select all

[b]SET @i:=0; [/b]SELECT @i:=@i+1 AS rank , client_code, SUM(invoice_total) AS Total_Value
FROM facturi
GROUP BY cod_client
ORDER BY val_totala DESC;
the error i get is generated by using SET before SELECT; if i paste the same code in any sql editor, it returns the corect data, with ranking and no errors.
how can i get the data i need? is there any way?

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 12 May 2008 14:07

We could not reproduce the problem.
Please send a complete small sample to dmitryg*crlab*com to demonstrate it, including a script to create and fill table.

Also supply us the following information
- exact version of Delphi, C++ Builder or Kylix;
- exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- exact version of MySQL server and MySQL client. You can see it in the Info sheet of TMyConnection Editor.

Post Reply