How to add aggregates and group tuples in TFDMemTable?

822 Views Asked by At

I have 2 TFDQuery objects connected to 2 different databases from which I'm fetching tuples and merging them into a single TFDMemTable. This works fine, but now I need to group those merged tuples and create certain aggregate fields.

For example, FDQuery1 and FDQuery2 having tuples of the following structure:

Country | UserName | BillCount | BillAmount | BillDiscount

I need to group them having aggregate fields like this:

Country | UserName | sum(BillCount) | sum(BillAmount) | sum(BillDiscount)

How to do this with FireDAC?

0

There are 0 best solutions below