SELECT roomno,type,price from room where price<='100'order by roomno desc,price desc 关键是最后一局,倒出来的结果只显示 roomno desc,不显示price desc 我知道mysql不支持循环,但这个问题怎么解决呢?
2 回答
慕桂英4014372
TA贡献1871条经验 获得超13个赞
出现这种情况那说明roomno的一列数据都不相同,如果price的一列有相同的数据,那应改为:
SELECT roomno,type,price
from room
where price<='100'
order by price,roomno DESC;
如下例:
SELECT name, species, birth FROM pet
ORDER BY species, birth DESC;
结果为:
name | species | birth |
+----------+---------+------------+
| Chirpy | bird | 1998-09-11 |
| Whistler | bird | 1997-12-09 |
| Claws | cat | 1994-03-17 |
| Fluffy | cat | 1993-02-04 |
| Fang | dog | 1990-08-27 |
| Bowser | dog | 1989-08-31 |
| Buffy | dog | 1989-05-13 |
添加回答
举报
0/150
提交
取消