本文介绍了帮我创建SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,
我有一个表(3个字段):ProjectID,Parents项目ID,Display项目ID
数据显示如下:

ProjectID父项目ID显示项目ID
00000666 0N0005N 00000666
00000667 0N0005N 00000667
00000668 0N0005N 00000668
00000669 0N0005N 00000669
00000670 0N0005N 00000670
00000671 0N0005N 00000671
08000043 0N0005N 08000043
08000044 0N0005N 08000044
0N0005N 0N0005N 0N0005N
0N75750N 0N0005N 0N75750N
0N77770N 0N0005N 0N77770N
0N90010N 0N0005N 0N90010N
0N99900N 0N0005N 0N99900N

我希望以粗体显示的单元格是主要项目,而其他的则是子项目.
您能帮我将主项目单元格移到表格顶部吗?
非常感谢您!

Dear all,
I hvae a table(3 fields): ProjectID, Parents project ID, Display project ID
Data display like that:

ProjectID Parents project ID Display project ID
00000666 0N0005N 00000666
00000667 0N0005N 00000667
00000668 0N0005N 00000668
00000669 0N0005N 00000669
00000670 0N0005N 00000670
00000671 0N0005N 00000671
08000043 0N0005N 08000043
08000044 0N0005N 08000044
0N0005N 0N0005N 0N0005N
0N75750N 0N0005N 0N75750N
0N77770N 0N0005N 0N77770N
0N90010N 0N0005N 0N90010N
0N99900N 0N0005N 0N99900N

I wish cells in bold is main project and the others is a sub project.
Can you help me move main project cell to the top of table.
Thanks you very much!

推荐答案

SELECT ProjectID, [Parents project ID], [Display project ID]
FROM Projects
ORDER BY [Parents project ID]


这篇关于帮我创建SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 22:23