如何使用具有特定值的列数来订购表 [英] How to order a table withe the number of the columns with a specific value

查看:67
本文介绍了如何使用具有特定值的列数来订购表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样一张桌子。

<前郎=文字> ID F01 F02 FO3
1 1 0 0
2 1 1 0
3 1 1 1



我想要这样的表格重新打印

 ID F01 F02 FO3 
3 1 1 1
2 1 1 0
1 1 0 0



因为第3行,有3个,一个在它的行。

第2行,有两个,一个在它的行。

和row1有一个,一个在它的行。

解决方案

您好,



您应该能够通过在订购条款。



  SELECT  
ID,F01,F02,F03
FROM
tblData
ORDER BY
ID DESC
F01 DESC
F02 DESC
F03 DESC


试试这个...

 选择 * 来自  tablename  
订单 F01 desc ,F02 desc ,FO3 desc



快乐编码! :)


您好,



查看此...



  SELECT  *  FROM  your_Table 订单   2   desc  3   desc  4  < span class =code-keyword> desc  





i未将id视为主要因素。专注于价值观。





也可以通过这个.. 排序方式 [ ^ ]





希望这会对你有所帮助。



干杯


Hi, I hava a table like this.

ID   F01   F02   FO3
1    1     0     0
2    1     1     0
3    1     1     1


I Want the table reOrder like this

ID   F01   F02   FO3
3    1     1     1
2    1     1     0
1    1     0     0


Because the row 3, have 3, one in it's row.
row 2, have two, one in it's row.
and row1 have, the one , one in it's row.

解决方案

Hi,

You should be able to achieve your desired order by specifying multiple columns in the order by clause.

SELECT
 ID,F01,F02,F03
FROM
 tblData
ORDER BY
 ID DESC, 
 F01 DESC, 
 F02 DESC, 
 F03 DESC


Try this...

select * from tablename
Order by F01 desc, F02 desc, FO3 desc


Happy Coding! :)


Hi,

Check this...

SELECT * FROM your_Table order by 2 desc, 3 desc, 4 desc



i have not considered id as prime factor. Gave focus on values.


Also go through this..Order By[^]


Hope this will help you.

Cheers


这篇关于如何使用具有特定值的列数来订购表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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