I'm using Unidac ver 7.4.11 26-Nov-18, on Delphi 10.2 Update 3 and Firebird 2.5 database.
Problem is in simple query which returns error when QueryRecCount property is True.
SQL query
Code: Select all
Select Group, Item, SUM(Amount) AS Amount FROM TestTbl GROUP BY 1,2;
I watched SQL execution in SQL monitor and SQL that you do for QueryRecCount is:
Code: Select all
SELECT COUNT(*) FROM ( SELECT 1 AS C FROM TestTbl GROUP BY 1,2 )
When I write SQL like:
Code: Select all
Select Group, Item, SUM(Amount) AS Amount FROM TestTbl GROUP BY Group, Item;
Code: Select all
SELECT COUNT(*) FROM ( SELECT 1 AS C FROM TestTbl GROUP BY Group,Item)
I tried same query in PostgreSQL and it works without any errors because in PostgreSQL you make SQL like:
Code: Select all
SELECT COUNT(*) FROM ( SELECT Group, Item, SUM(Amount) AS Amount FROM TestTbl GROUP BY 1,2 )
Example that I posted is simplified, in real life, i really need to use column position instead of column names.
Can you fix QueryRecCount in Firebird with GROUP BY clause or give me some other solution which leave column position in group by clause.
Thanks.