爱玺玺

爱玺玺的生活日记本。wx:lb87626

mysql获取某个竞拍商品的最高出价人

这里是这款商品的所有出价

mysql> select uid,price

 from auction_price_history where gid=26;

+------------------+-------+

| uid              | price |

+------------------+-------+

| 1602231136492187 | 100   |

| 1603021316454064 | 60    |

| 1602231136492187 | 80    |

| 1602231136492187 | 200   |

| 1603021316454064 | 150   |

| 1602231136492187 | 160   |

| 1603021316454064 | 200   |

| 1603021316454064 | 500   |

| 1603021316454064 | 501   |

+------------------+-------+

9 rows in set

这里是找出这款商品所有出价中出价最高的那个人

mysql> select uid,price from auction_price_history where gid=26 and price=(select max(price) from auction_price_history where gid=26);

+------------------+-------+

| uid              | price |

+------------------+-------+

| 1603021316454064 | 501   |

+------------------+-------+

1 row in set


发表评论:

Powered By Z-BlogPHP 1.4 Deeplue Build 150101

Copyright Your WebSite.Some Rights Reserved.

蜀ICP备11021721号-5