假设我的数据库中有三个字段,如下所示:
ID Title MaxVisited
1 hi 6
2 bye 8
3 How? 9
4 News! 8
5 Hey 3
6 Thanks 9
现在我想选择MaxVisited最大值的标题三..我想要的结果:
Thanks , How? , News!
答案 0 :(得分:3)
只需选择前三名,然后按MaxVisited
和(如有必要)Id
列
SELECT TOP 3 Title from [TableName]
order by MaxVisited, Id desc
答案 1 :(得分:1)
试试这个
SELECT TOP 3 Title
From [TableName]
order by MaxVisited,Title desc
答案 2 :(得分:0)
SELECT TOP 3 Title from [your_table]
order by MaxVisited, ID desc