select * from tbl_1
union
select * from tbl_2

解决方案 »

  1.   

    试试,调试一下:
    SELECT username,password
    FROM table1
    UNION
    SELECT DISTINCT t1.username,t1password,t2.username,t2.password
    FROM table1 t1, table2 t2
    WHERE t1.username= t2.username AND 
    t1.password =t2.password
      

  2.   

    insert into tbname1 select * from tbname2;select * from (
    select * from tbname1
    union 
    select * from tbname2) t 
    where t.col=......;
      

  3.   

    再具体点:就是根据username选出password
    请给出相应的例子。谢谢
      

  4.   

    create table table3 as 
    select username,password from table1
    union
    select username,password from table2 ;drop table1;
    drop table2;rename table3 to table1;
      

  5.   

    select  *
    from 
    (select username,passwordfrom tbl_1
    union
    select username,password from tbl_2) a
    where a.username = 'aaa'
      

  6.   

    SELECT A.*,B.* FROM table1 A,table2 B
           WHERE A.username='xxxx' or b.username='xxxx' ;
      

  7.   

    create view v_tab
    as 
    select username,passwordfrom tbl_1
    union
    select username,password from tbl_2;select * from v_tab where ...
    如果2个表中记录没有重复的,可以将union换成union all,能加快速度。