× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Elvis Budimlic wrote:
On the second look, my update can be simplified a bit:

UPDATE myFile A SET A.SEQ_# = (SELECT ORDINAL_NUMBER FROM (SELECT FISCAL_YEAR,CONTROL_GROUP,SOURCE_CODE, ROW_NUMBER() OVER(ORDER BY FISCAL_YEAR) AS ORDINAL_NUMBER
FROM myFile
GROUP BY FISCAL_YEAR,CONTROL_GROUP,SOURCE_CODE) B
WHERE A.FISCAL_YEAR = B.FISCAL_YEAR AND A.CONTROL_GROUP = B.CONTROL_GROUP AND A.SOURCE_CODE = B.SOURCE_CODE)

Yup, this does the trick. You can use the ORDER BY clause to change the sequence the numbers are incremented, and it updates perfectly. I have to remember the UPDATE using a subselect technique.

Thanks, Elvis! (Another one of those folks who have forgotten more than I know about RDBMS.)

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.