select b.DateCreate, b.ProductNo,c.ProductTitle ,c.ProductPicFile ,(select count(distinct userid) from WfsCommentary as d where d.productno=b.productno and CommentaryType =1)as total,
(select count(*) from dbo.WfsCommentary as y where CommentaryType='1' and y.userid=a.userid and y.productno=b.productno)as totalcomments,
(select max(dateCreate) as dc from dbo.WfsCommentary as y where CommentaryType='1' and y.userid=a.userid and y.productno=b.productno)as dct
from dbo.WfsOrder a ,dbo.WfsOrderDetail b ,wfsProduct c where a.userid='6B99756DE402FFD09EBB2C86602B2584'
and a.orderno=b.orderno and a.Status=99 and b.productno=c.productno
希望最好可以提供一个表结构
怪不得没人回答,这种水平的提问。
不重复?..distinct.不行?
你加distinct?
哥你太会省事了……
查询语句中加入 distinct 就行。
有表结构的话,就可以一眼明了。