SELECT roomno,type,price from room where price<='100' order by roomno desc,price desc 关键是最后一局,倒出来的结果只显示 roomno desc,不显示price desc 我知道mysql不支持循环,但这个问题怎么解决呢?
慕尼黑8549860
浏览 396回答 2
2回答
慕桂英4014372
出现这种情况那说明roomno的一列数据都不相同,如果price的一列有相同的数据,那应改为:SELECT roomno,type,pricefrom roomwhere price<='100'order by price,roomno DESC;如下例:SELECT name, species, birth FROM petORDER 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 |