我在mysql数据库中有一个表。表'sell_stats'
+-------------------+-----------+--------+
| id | max_price | sell_price| orders |
+-------------------+-----------+--------+
| 1 | 120 | 110 | 1 |
| 2 | 324 | 324 | 0 |
| 3 | 445 | 445 | 1 |
| 4 | 654 | 654 | 1 |
| 5 | 657 | 657 | 0 |
| 6 | 456 | 456 | 2 |
+-----------------+-------------+--------+
我想找到 max_price!= sell_price
的列我为那个
写了这个查询select * from sell_stats where max_price != sell_price;
但我收到了错误
ERROR 1111 (HY000): Invalid use of group function.
然后我尝试将它们分组为id,但仍然是同样的错误。
select * from sell_stats where max_price != sell_price group by id;
请有人帮我吗?
答案 0 :(得分:-2)
试试这个:
select * from sell_stats where max_price <> sell_price;