One question about Postgresql selects. This works as it should:
SELECT
name,SUM(cash)
FROM
costumers
GROUP BY (name)
but how can I concat two (or more) fields in the GROUP BY clause?
This is what I tried:
SELECT
name,SUM(cash)
FROM
costumers
GROUP BY (name || ' ' || nickname)
That will work, except that you need to select the expression you group by:
Another option is to group by two fields by separating them with a comma:
Note that these two are not exactly equivalent. In particular these two rows will end up in the same group with the first version and in different groups in the second version:
The second option is probably what you mean.