I'm using Postgres 9.6. I have a query like this:
SELECT name, count(spend) as spend FROM mytable GROUP BY name;
This produces results like Dave,40000.
I would like to add a unique identifier to each result (yes, I know the name is already a unique identifier, but I would like a numeric one). So I would like results like 1,Dave,40000.
It doesn't particularly matter what the unique identifiers are as long as they're numeric, but they might as well be integers.
Is there an easy way to do this with Postgres?