Tuesday, March 31, 2015

Dynamic Value for Column

SQL Server 2012 and onwards


SELECT <coolumns>,



LAST_VALUE(NO_REFERRALS) OVER (PARTITION BY code ORDER BY month DESC
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) LstValue

FROM tbl




Best Regards,Uri Dimant SQL Server MVP, http://ift.tt/1iQ9JkR



MS SQL optimization: MS SQL Development and Optimization

MS SQL Consulting: Large scale of database and data cleansing

Remote DBA Services: Improves MS SQL Database Performance

SQL Server Integration Services: Business Intelligence


No comments:

Post a Comment