作者kennykobe (凤山下智久)
看板Database
标题[SQL ] 资料排序升幂
时间Mon May 15 11:55:03 2017
我想要更改SQL里面的资料,projno那个栏位的值
目前是没照顺序排列的,请问各位大大有什麽指令
可以让那个顺序依照升幂排序呢
http://imgur.com/a/5z736
让projno这栏位的值变成
projno
1
1
2
2
3
3
5
6
还有假如以後塞进SQL DB的资料如何让它按照projno的顺序排呢??
小弟SQL新手@@,请各位大大相救,3Q
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.248.18.139
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Database/M.1494820506.A.AB0.html
※ 编辑: kennykobe (60.248.18.139), 05/15/2017 12:36:13
1F:→ streetbad: 改变现有排序? 还是只是捞出来想要有顺序的显示? 05/15 14:44
2F:→ streetbad: 另外 以後塞新资料要按照projno排序应该无法 05/15 14:44
3F:→ freeunixer: 如果是要排序 table, order by 存到另一个 table, 05/15 16:14
4F:→ freeunixer: 把原本的 table drop 掉,把新 table rename 成原本的 05/15 16:15
5F:→ freeunixer: 注意一下使用者对该 table 的存取权限 05/15 16:15
6F:→ freeunixer: 新增的资料不能插中间..RDBMS 不是要让你这样用... 05/15 16:17
7F:推 futureisours: 建立丛集索引 05/15 21:00
8F:→ SeanBoog: 你如果目的是资料呈现有序 那就只要sql+order 05/16 00:33
9F:→ SeanBoog: 蛮好奇为什麽physical也要跟着动 05/16 00:33
10F:→ SeanBoog: 是不是有什麽特殊目的 05/16 00:34
11F:推 ken218: 如果是 SQL Server, Table 可以有一个 clustered index. 06/16 18:33
12F:→ ken218: 把它设在projno栏位上就可以收工了。这样 query 跟 inser 06/16 18:33
13F:→ ken218: t 都会升幂排序 06/16 18:33