Skip to content Skip to sidebar Skip to footer

After 13th Row Dynamic And In 12th Row Static Values With A Formula

Below is the SQL Query I used to create as view CREATE VIEW [v_AMP_C] AS SELECT dbo.IC_Raw_In.I_Date, dbo.IC_Raw_In.I_O_P, dbo.IC_Raw_In.I_O_H, dbo.IC_Raw_In.I_O_L, dbo.

Solution 1:

There is a certain 'wrongness' with the concept - primarily because any such row inter-relation between row X and Y relies on the rows being in a specified order - which I do not see present. IT goes against the set-based aspects of the SQL language in effect.

In terms of SQL - the slow / expensive way to do it is to join the table to itself, but you have to be able to create row numbers deterministicallt using a ranking function for this to work.

Standard T-SQL does not have a Lag / Lead ability (the abilty to reference the previous / nextrow.) - It does exist in the MDX langauge but that complicates this further.

Post a Comment for "After 13th Row Dynamic And In 12th Row Static Values With A Formula"