这里选择前一记录的情况:我有一个表myTable
其中包含3列:在SQL Server 2008中
ID
int, identity
Group
varchar(2), not null
value
decimal(18,0), not null
表看起来像这样:
ID GROUP VALUE Prev_Value Result
------------------------------------------
1 A 20 0 20
2 A 30 20 10
3 A 35 30 5
4 B 100 0 100
5 B 150 100 50
6 B 300 200 100
7 C 40 0 40
8 C 60 40 20
9 A 50 35 15
10 A 70 50 20
Prev_Value
和Result
列应该是自定义列。我需要把它放在视图上。任何人都可以帮忙请...非常感谢。
你能解释一下“自定义字段”吗 – Bharadwaj
我觉得他是指计算字段。 –
请解释您用于生成Prev_Value和Result的规则。我看不到任何模式。 –