In a query like this:
Code: Select all
LiteQuery1.SQL.Clear;
LiteQuery1.SQL.Add('SELECT `id`, `id5` FROM testtable WHERE `id5` = 10');
LiteQuery1.SQL.Add('UNION ALL');
LiteQuery1.SQL.Add('SELECT `id`, `id5` FROM testtable WHERE `id5` = 9');
LiteQuery1.SQL.Add('ORDER BY `id`');
LiteQuery1.Execute;
if not LiteQuery1.Eof then
LiteQuery1.FieldByName('id').AsInteger;
The query has to contain "UNION ALL" and "ORDER BY" to reproduce this error.