使用group by 分组,语句如下:
select prod_id,fea_spec_id from prod_fea where prod_id=2012 group by prod_id,fea_spec_id having count(fea_spec_id) = 2
select top(*)1 from prod_fea where prod_id=2012 order by modify_date desc
select prod_id,fea_spec_id,min(prod_id),count(*) from prod_fea where prod_id=2012 group by prod_id,fea_spec_id having count(*) >1