Hi
I need to display a list of subtotals for the records which have the same number field, but in the original order, provided by the id field. The following generates error, because the distinct and the order by expressions are not the same.
SELECT DISTINCT ON (number) number, sum(value) FROM report ORDER BY id;
Have anyone an idea, how to do this ?
Thanks,
Feherke.
I need to display a list of subtotals for the records which have the same number field, but in the original order, provided by the id field. The following generates error, because the distinct and the order by expressions are not the same.
SELECT DISTINCT ON (number) number, sum(value) FROM report ORDER BY id;
Have anyone an idea, how to do this ?
Thanks,
Feherke.