首页 新闻 赞助 找找看

求查询不重复的数据

0
悬赏园豆:20 [已关闭问题] 关闭于 2009-11-24 13:35

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

Ahuan的主页 Ahuan | 初学一级 | 园豆:180
提问于:2009-11-10 10:54
< >
分享
所有回答(6)
0

希望最好可以提供一个表结构

canbeing | 园豆:1287 (小虾三级) | 2009-11-10 12:51
0

怪不得没人回答,这种水平的提问。

风海迷沙 | 园豆:4453 (老鸟四级) | 2009-11-10 17:04
0

不重复?..distinct.不行?

邢少 | 园豆:10926 (专家六级) | 2009-11-11 11:32
0

你加distinct?

Peter Yao | 园豆:225 (菜鸟二级) | 2009-11-11 18:59
楼下的不是解决问题的正确态度,请纠正!
支持(0) 反对(0) Peter Yao | 园豆:225 (菜鸟二级) | 2009-11-11 18:59
0

哥你太会省事了……

chocol@te | 园豆:325 (菜鸟二级) | 2009-11-24 11:09
0

查询语句中加入 distinct 就行。

有表结构的话,就可以一眼明了。

狼群乌托邦 | 园豆:190 (初学一级) | 2009-11-24 11:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册