I have a table that with the following query gives me all the double values.
SELECT workorder, job.count
FROM (
SELECT workorder,
COUNT(*) OVER (PARTITION BY workorder) AS count
FROM engineering_job_schedule) AS job
WHERE job.count > 1 and workorder is not null
This will return something like
| workorder | cnt |
|---|---|
| M-22.20.171.3017 000001 | 2 |
| M-22.20.171.3017 000001 | 2 |
| M-22.20.176.3023 000001 | 2 |
| M-22.20.176.3023 000001 | 2 |
Now how would you use this query to create an UPDATE query to update all workorder values to a new counting-up number.
So that my new value would be
| workorder |
|---|
| M-22.20.171.3017 000001 |
| M-22.20.171.3017 000002 |
| M-22.20.176.3023 000001 |
| M-22.20.176.3023 000002 |