如何在SELECT查询中按多列排序? [英] How do I order by multiple columns in a SELECT query?
本文介绍了如何在SELECT查询中按多列排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个类似下面的记录表
I have a table of records like below
int_record_id int_category_id str_name int_order bit_active
1 1 test1 2 1
2 1 test2 1 1
3 2 test3 1 1
1 3 test4 3 1
我要选择此记录,以便应同时按int_category_id
和int_order
i want to select this record in a such a way that it should be sorted in the order of both int_category_id
and int_order
所以结果应该像下面的
int_record_id int_category_id str_name int_order bit_active
2 1 test2 1 1
1 1 test1 2 1
3 2 test3 1 1
4 3 test4 3 1
有人对它的sql查询有想法吗,我尝试了很多我没有得到正确的结果. 谁能告诉我确切的SQL查询.
Does any one have an idea about its sql query, i have tried a lot i'm not getting the result correct. can any one show me the exact sql query for this.
推荐答案
select * from your_table order by int_category_id, int_order
这篇关于如何在SELECT查询中按多列排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文