标签: mysql sql select max min
列出折扣最大的客户的ID和折扣百分比
和那些折扣最小的人。
答案 0 :(得分:0)
您可以使用MAX()和MIN()函数来获取具有最大值且ID具有最小折扣的ID。
Select id,discount from customer where discount=(select MAX(discount) from customer) OR discount=(select MIN(discount) from customer);