日期:2014-05-18 浏览次数:20920 次
select top(1) b.id,b.title,b.content,b.productId,a.producttitle,a.promotionPrice,c.ProductPhoto from product a ,consultation b ,productphotos c where a.productId = b.productId and a.productId = c.productId group by b.id,b.title,b.content,b.productId,a.producttitle,a.promotionPrice order by c.ReleaseTime desc
------解决方案--------------------
try
SELECT commt.Id,commt.Title,commt.Content,commt.ProductID,prod.ProductTitle,prod.PromotionPrice,prodimg.ProductPhoto FROM commentary AS commt INNER JOIN product AS prod on(commt.ProductID=prod.Id) INNER JOIN productphotos AS prodimg ON(prod.Id=prodimg.ProductID) WHERE prodimg.releasetime=(select top 1 releasetime from productphotos where ProductID=commt.ProductID and releasetime>=commt.dateandtime order by releasetime)