SQL查询(更新连续行,除非值更改) [英] SQL Query (Update Consecutive Rows Unless Value Change)
本文介绍了SQL查询(更新连续行,除非值更改)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个SQL查询。
输入:
I Want A SQL Query.
Input :
1 A
2
3
4
5
6
7
8
9
10
11
12 B
13
14
15
16 C
17
18
19
20
21
22
23
24
25
26
27 D
28
29
30
31
32
33
34
35
36
37
38
39 E
40
输出:
Output :
1 A
2 A
3 A
4 A
5 A
6 A
7 A
8 A
9 A
10 A
11 A
12 B
13 B
14 B
15 B
16 C
17 C
18 C
19 C
20 C
21 C
22 C
23 C
24 C
25 C
26 C
27 D
28 D
29 D
30 D
31 D
32 D
33 D
34 D
35 D
36 D
37 D
38 D
39 E
40 E
我希望单输出查询。 (没有光标。)
请帮助。
I Want This Output In A Single Query. (No Cursor.)
Please Help.
推荐答案
有没有连续的行。存储在表中的数据是从任何具体顺序中抽象出来的。该命令仅作为某些查询的结果出现,然后您可以使用SQLORDER BY
子句来控制它:http://technet.microsoft.com/en-us/library/ms188723%28v=sql.90%29.aspx [ ^ ]。
因此,这个问题毫无意义。如果你解释了你的最终目标,你可能会得到一些实用的建议。
-SA
There are no "consecutive rows". The data stored in a table is abstracted from any concrete order. The order only appears as a result of some query, and then you can control it, say, using SQLORDER BY
clause: http://technet.microsoft.com/en-us/library/ms188723%28v=sql.90%29.aspx[^].
Therefore, the question makes no sense. You can probably get some practical advice if you explain your ultimate goal.
—SA
这篇关于SQL查询(更新连续行,除非值更改)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文