答案 0 :(得分:2)
尝试此查询
select User_id,auction_id,price from tablename where price in(select price from tablename where id in(select max(id) from tablename group by user_id))
答案 1 :(得分:0)
如果您错误地更新了输出,请按照提供的条件尝试 -
select user_id,auction_id,price
from mytable
where user_id=41
order by auction_id;
但是如果根据你的输出你需要1行最新的user_id = 41然后所有行的最高价格那么你可以试试 -
SELECT user_id,auction_id,price
FROM mytable
WHERE user_id=41
ORDER BY id DESC LIMIT 1
UNION
SELECT b.user_id,b.auction_id,price
FROM mytable b
JOIN (
SELECT MAX(price) AS price
FROM mytable
) a ON a.price=b.price;
答案 2 :(得分:0)
根据你想要的输出试试这个:
select user_id,auction_id,price
from table_name
where user_id=41
order by id desc;