本以为直接在where 语句中插入max() 以及min() 就行了,结果试了报语法错误。后发现需要在where 里插入子句
以查询订单表中最大、最小的订单号以及对应的顾客为例:
select id
,member_id
from hy_order_20170410
where order_money=
(select max(order_money)
from hy_order_20170410 as max_money)
or order_money=
(select min(order_money)
from hy_order_20170410 as min_money);