May 5, 2011 at 12:34 pm
I'm talking about a clustered index on field8 and a nonclustered index like
CREATE NONCLUSTERED INDEX ncindx1 ON table1 (field3,field2) include (field1)
May 6, 2011 at 10:38 am
Maybe I need another cup of coffee, but I don't see how ROW_NUMBER can help with this classic 'running totals' type of scenario. Best bet for that is actually a cursor given that SQL Server doesn't (yet) have full support for windowing functions. 🙁
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
May 6, 2011 at 3:18 pm
TheSQLGuru (5/6/2011)
Maybe I need another cup of coffee, but I don't see how ROW_NUMBER can help with this classic 'running totals' type of scenario. Best bet for that is actually a cursor given that SQL Server doesn't (yet) have full support for windowing functions. 🙁
Based on the subquery SELECT count(*) + 1 FROM table1 o WHERE field2 > o. field2
joining back to the original table and therewith building a triangular join I concluded this is a ROW_NUMBER scenario rather than a running total issue.
The result set would be a consecutive number assigned to each row.
Table def, sample data and some expected results would have been better though in order to verify we're on the right track. As per now sample data and expected results are still missing.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply