declare @mytable table
(
productId int,
bigClassId int,
aField int
)
insert into @mytable
select top 10 productid,bigClassid,count(id)+sum(supportNum) as aField from tbcomments
group by productid,bigclassid order by aField desc
(select t.name,p.aField from tbTravel_Info t,@mytable as p where t.id=p.productid
union
select i.name,p.aField from tbAccident_Info i,@mytable as p where i.id=p.productid )
order by afield