在sql server 2008示例中查询行的更新顺序 [英] query for update order of rows in sql server 2008 example

查看:85
本文介绍了在sql server 2008示例中查询行的更新顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要更新订单号.

参见例如

ID名称orderno

1 ss 4
2页1
3毫米3
4 nn 2


如果我将orderno 1设置为2,则2将自动更改为1.


任何想法的人.

Hai all,

I need for updating order no.

see for example

ID Name orderno

1 ss 4
2 pp 1
3 mm 3
4 nn 2


If i set the orderno 1 for 2 means 2 will automatically change to 1.


any idea guys.

推荐答案



我也没听清楚这个问题.

如果要更新列,则该语句将类似于:

Hi,

I didnt get the question as well.

if you want to update a column than the statement would be something like:

UPDATE myTable
SET mycol=myvalue, mycol2=myvalue2,...
WHERE mycol*=anyvalue



如果您只想对col进行排序而不是使用:



if you just want to sort a col than use:

SELECT mycol
FROM mytable
ORDER BY mycol* 


这篇关于在sql server 2008示例中查询行的更新顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆