wdguy
10-21-2007, 03:55 PM
I was wondering if there's any way in PostgreSQL to sort a table by a certain column and then add a column that just contains numbers 1,2,3,4, and so on. For example, if the table is
fruit quantity
apple 5
orange 8
banana 2
peach 10
the resulting table should look like:
fruit quantity key
banana 2 1
apple 5 2
orange 8 3
peach 10 4
fruit quantity
apple 5
orange 8
banana 2
peach 10
the resulting table should look like:
fruit quantity key
banana 2 1
apple 5 2
orange 8 3
peach 10 4