select distinct xxx,yyy from table得不到我想要的数据集
select p.smallimg,p.id,p.name,p.prod_cd,p.marketprice,p.multi_pic from productsort c right outer join product p on p.productsort=c.id where c.fatherid=187 and p.smallimg in(select distinct smallimg from product) order by p.id desc
我测试过,不行,
当然只是用select distinct smallimg from product 是可以的
我又用
select distinct p.smallimg,p.id,p.name,p.prod_cd,p.marketprice,p.multi_pic from productsort c right outer join product p on p.productsort=c.id where c.fatherid=187 也不行
又加了group by还是不行
我的意思是
select distinct XXX from table当然是可以的
只是想一并取出其它字段时则不对
比如说
select distinct xxx,yyy from table就不对了
我改成 select xxx,yyy from table where xxx in(select distinct XXX from table)
竟然也不对。气坏了
help me