我有饭桌。
我需要先显示“开放餐厅”&然后显示关闭餐厅的结果,我还搜索了zipcode是2600。所以,首先列出zipcode 2600,然后是开放餐厅,然后是开放餐厅的其他zipcode。然后是2600个封闭餐厅,然后是其他封闭餐厅。
restid resname Zipcode status
1 Res1 2600 Open
2 Res2 2500 Closed
3 Res3 3600 Closed
4 Res4 2600 Open
5 Res5 2500 Closed
6 Res6 2600 Open
7 Res7 3600 Open
8 Res8 3600 Open
9 Res9 2500 Closed
10 Res10 2600 Closed
我需要这样的结果。。。
restid resname zipcode status
1 Res1 2600 Open
2 Res4 2600 Open
3 Res6 2600 Open
4 Res7 3600 Open
5 Res8 3600 Open
6 Res2 2500 Closed
7 Res3 3600 Closed
8 Res5 2500 Closed
9 Res9 2500 Closed
10 Res10 2600 Closed
提前谢谢。
最佳答案
select restid,resname,zipcode,status from sometable order by statys desc