By the way, google's query language has a PIVOT syntax: https://developers.google.com/chart/interactive/docs/querylanguage#Pivot
Eg. select sum(salary) pivot dept Would be nice if Firebird could do the same, I understand you couldn't use it inside a stored procedure, where your columns need to be known up front, but your could use it to query your selectable stored procedure, which would be very nice ;-)
