这样行不行,先建立一个视图,然后才从视图中读取
create view viewname as
select "最新新闻",id, …… from news
union
select "最新评论",id, …… from pinglunselect * from viewname order by ……

解决方案 »

  1.   

    create table #a(id char(4) primary key,in_date datetime)
    insert into #a(id,in_date) values('001','2002-02-02')
    insert into #a(id,in_date) values('002','2002-02-03')create table #b(no int identity(1,1) primary key,id char(4),in_date datetime)
    insert into #b(id,in_date) values('001','2002-02-02')
    insert into #b(id,in_date) values('002','2002-02-03')
    insert into #b(id,in_date) values('001','2002-02-03')
    select id,in_date,"新闻" as bj from #a union select id,in_date,"评论" as bj from #b order by id,bj desc
    drop table #a
    drop table #b