Hi all!
I'm new in PostgreSQL and I need some help.
I have a table:
MyTable
----------------------
ID | Price | Units
----------------------
1 | 1.27 | 12
2 | 1.12 | 22
3 | 1.12 | 11
4 | 1.27 | 10
5 | 0.99 | 7
----------------------
and I need to count amount:
SELECT SUM(Price*Units) as amount FROM MyTable
but I need knew what IDs were included in each calculated line.
My question: can I create an array and push IDs in it:
SELECT SUM(Price*Units) as amount, {ID} as ids FROM MyTable
Thanks in advanced.