SQL code:
SELECT t1.brid,t1.productId,t1.sellerId,t1.price,t1.inputDt from
(SELECT *from dbo.vw_BidReply_list WHERE bid=7) t1,
(SELECT MIN(price) AS minPrice,productId from dbo.vw_BidReply_list a WHERE bid=7 GROUP BY productId
) t2
WHERE t1.price=t2.minPrice AND t1.productId=t2.productId
--brid--price--productId--sellerId------inputdate
--19----2.02----34----------43----------2010-02-24 16:34:42.25
--18----0.79----22----------25----------2010-02-24 16:34:41.25
--13----0.79----22----------43----------2010-02-24 16:34:44.25
怎么得到下面的两条数据,注意日期
--brid--price--productId--sellerId------inputdate
--19----2.02----34----------43----------2010-02-24 16:34:42.25
--18----0.79----22----------25----------2010-02-24 16:34:41.25
SQL code:
select * from (SELECT t1.brid,t1.productId,t1.sellerId,t1.price,t1.inputDt from
(SELECT *from dbo.vw_BidReply_list WHERE bid=7) t1,
(SELECT MIN(price) AS minPrice,productId from dbo.vw_BidReply_list a WHERE bid=7 GROUP BY productId
) t2
WHERE t1.price=t2.minPrice AND t1.productId=t2.productId) C group by sellerId
having inputdate=max(inputdate)
试试这种行不行
什么意思?取时间小的两条?