日期:2014-05-18 浏览次数:20583 次
select c.企业标识, c.企业简称,j.更新时间 from ska j join skb c on c.企业标识=j.经销商编号 join skc i on i.cartype_id=j.编号 join (select distinct top 5 c.企业标识 from ska j join skb c on c.企业标识=j.经销商编号 join skc i on i.cartype_id=j.编号 where i.brand_id=5 and c.是否审核=1 and i.carflag <> 6 and j.售价> 0 order by j.更新时间 desc ) s on s.企业标识=c.企业标识 where i.brand_id=5 and c.是否审核=1 and i.carflag <> 6 and j.售价> 0 order by j.更新时间 desc
------解决方案--------------------
select top 5 c.企业标识, c.企业简称,j.更新时间
from ska j
join skb c on c.企业标识=j.经销商编号
join skc i on i.cartype_id=j.编号
where i.brand_id=5 and c.是否审核=1 and i.carflag <> 6 and j.售价> 0
group by c.企业标识, c.企业简称,j.更新时间 order by j.更新时间 desc
------解决方案--------------------
select distinct top 5 distinct c.企业标识, c.企业简称,j.更新时间
from ska j
join skb c on c.企业标识=j.经销商编号
join skc i on i.cartype_id=j.编号
where i.brand_id=5 and c.是否审核=1 and i.carflag <> 6 and j.售价> 0
group by c.企业标识, c.企业简称,j.更新时间
order by j.更新时间 desc