sql query
Posted: 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:
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?
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;
how can i get the data i need? is there any way?