[英]Sort Data based on uniqueidentifier data type column
I have table in that there are relation between Parent and Child, in this my ParentID and SID data type is uniqueidentifier , now I want to sort the data based on the it's ParentID. 我有表格,父和子之间有关系,我的ParentID和SID数据类型是uniqueidentifier ,现在我想根据它的ParentID对数据进行排序。 the value in my table is like below:
我的表中的值如下所示:
How can I sort the data of this table based on the ParentID. 如何根据ParentID对此表的数据进行排序。 Any one please help me to archive this.
任何人请帮我归档这个。
You can just use an ORDER BY
in your SELECT
statement. 您可以在
SELECT
语句中使用ORDER BY
。
SELECT SubjectName, ParentID, SubjectID, SID
FROM yourTable
ORDER BY ParentID
It might look like the data isn't sorted but it is, it just sorts different since it is a uniqueidentifier. 它可能看起来像数据没有排序但是它只是排序不同,因为它是一个uniqueidentifier。 Here is some info I found on sorting by GUIDs.
以下是我在按GUID排序时发现的一些信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.