以下是该表中一些示例数据的图片:
plz为我提供完整的代码。我将非常感谢你们所有人。
$productid=$_session['productid'];
select bidamount, userName,productid
from bid
where
productid = '$productid'
and bidamount = (
select min(lowest_bid.bidamount)
from bid lowest_bid
where
lowest_bid.productid = '$productid'
group by lowest_bid.bidamount
having count(distinct lowest_bid.userName) = 1
order by closing_date
limit 1
)
答案 0 :(得分:0)
如果我正确地阅读您的问题,您可以使用SQL语句非常简单地执行请求:
select productid, min(bidamount) from bid where productid='$productid' group by productid
您也可以完全跳过使用group子句并使用
select productid, bidamount, username from bid where( select min(bidamount) from bid where productid='$productid')=bidamount