select * from table1
where not exists (
 select * from table2
 where table2.field4=table1.field1
 )
union all
select * from table2

解决方案 »

  1.   

    select Field1 ,Field2,Field3 from table1
    union
     select Field1 ,Field2,Field3 from table2
    union
     select table1.Field1 , table2.Field2, table1.Field3
     from Table1,table2
     where table1.Field1 = table2.Field1
     and table1.Field3 = table2.Field3
      

  2.   

    对不起,说错了
    我想得到的记录集是:
    Field1 Field2 Field3
      A1     B1     C1
      A2     B8     C2
      A3     B7     C3
      A4     B4     C4
      A6     B6     C6
      A7     B9     C9
      

  3.   

    select field1,field2,field3 from table1
    where not exists (
     select * from table2
     where table2.field4=table1.field1
     )
    union all
    select field1,field5 as field2,field3 from table2,table1
    where table2.field4=table1.field1
      

  4.   

    select field1,field2,field3 from table1
    where not exists (
     select * from table2
     where table2.field4=table1.field1
     )
    union
    select field4,field5,field6 from table2
    where not exists (
     select * from table1
     where table2.field4=table1.field1
     )
    union
    select field1,field5,field3 from table2,table1
    where table2.field4=table1.field1