'Sqlite running total fails when executed from Embarcadero Delphi

I have unsuccessfully tried to execute a SELECT from inside Delphi XE7. The same query perfectly works when run from inside SqliteExpert (or any other similar app).

I have trie several variations of the SELECT, but all of them fail with the same error message.

I give you an example of the select I would like to run:

FDQry.SQL.Clear;
FDQry.SQL.Add(SELECT num, account, amount, SUM(amount) OVER ( ROWS UNBOUNDED PRECEDING ) AS RunningTotal FROM MyTable where account='NFI');
FDQry.Open;

I get this error:

" " near "(" syntax error "



Solution 1:[1]

I don't know if it is a error in the example, but you need to use quotes inside the Add. The parameter is a string after all.

FDQry.SQL.Add(' ..... ');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Eirik A.