有两个表 分别 有相同的主键, 如何加一个视图,可以查询两个表的字段?
A 表有 account name    B表有  account   sex   id 

解决方案 »

  1.   

    --两个表是通过account关联的吗?
    create or replace view selectview
    as
    select a.account,a.name,b.*
    from a,b
    where a.account=b.account
      

  2.   


    CREATE OR REPLACE VIEW TEST(account, name, sex,id)
    as
     select account, name,sex,id from A,B
     where A.account = B.account
      

  3.   

    create view v_ab
    as
    select a.account,a.name,b.sex,b.id
    from a,b
    where a.account=b.account
      

  4.   

    create or replace view selectview
    as
    select  *
    from a,b
    where a.account=b.account
      

  5.   


    create or replace view vname
    select a.account,a.name,b.sex,b.id
    from a,b
    where a.account=b.account
      

  6.   

    create view v_ab
    as
    select a.account,a.name,b.sex,b.id
    from a,b
    where a.account=b.account
      

  7.   

    create or replace view vname
    select a.account,a.name,b.sex,b.id
    from a,b
    where a.account=b.account