Re: [GENERAL] update records to have occurance number

2016-10-25 Thread Cachique
HI: You can use windows functions. https://www.postgresql.org/ docs/9.5/static/tutorial-window.html specifically row_number(). https://www.postgresql.org/ docs/9.5/static/tutorial-window.html I'm assuming that your ordering is based on lname and then fname. The query for getting 'number' is san

Re: [GENERAL] update records to have occurance number

2016-10-25 Thread Alban Hertroys
> On 25 Oct 2016, at 17:06, Mark Lybarger wrote: > > I want to update a table to have the value of the occurrence number. For > instance, I have the below table. I want to update the number column to > increment the count of last name occurrences, so that it looks like this: > > first last

[GENERAL] update records to have occurance number

2016-10-25 Thread Mark Lybarger
I want to update a table to have the value of the occurrence number. For instance, I have the below table. I want to update the number column to increment the count of last name occurrences, so that it looks like this: first last 1 second last 2 third last 3 first other 1 next other 2 Here's my