select * from student
union all
select * from teacher

解决方案 »

  1.   

    我用过union,但是错误提示说建视图不能用union
    不知道union和union all有什么不一样呢?
      

  2.   

    --我测试过是可以的.create view test
    as
    select * from sysobjects
    union
    select * from sysobjects
    gocreate view test1
    as
    select * from sysobjects
    union all
    select * from sysobjects
    godrop view test,test1
      

  3.   

    --查询分析器中执行下面的语句创建视图:create view 视图名
    as
    select * from student
    union all
    select * from teacher
      

  4.   

    union 的话,会去掉结果集中的重复记录,而union all 则不会.
      

  5.   

    我建出来了
    create view passwordview
    as
    select s_num,s_password from student
    union all
    select t_num,t_password from teacher
    我这样建的话,我以后引用这个视图的列名时该用什么呢?