MS SQL 2005: Previous row value
SQL 2005 can number rows by command:
ROW_NUMBER() OVER (ORDER BY field_x,y…)
Another usefull 2205's command allowing "aliasing SQL" is:
WITH table_name AS ( SELECT … ) SELECT table_name ….
Command can be used for creating "virtual" (calcluated) columns
Below, snippet presenting how to archive previous row values in one SQL query.
ROW_NUMBER() OVER (ORDER BY field_x,y…)
Another usefull 2205's command allowing "aliasing SQL" is:
WITH table_name AS ( SELECT … ) SELECT table_name ….
Command can be used for creating "virtual" (calcluated) columns
Below, snippet presenting how to archive previous row values in one SQL query.
Labels: TSQL
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home