Oracle sql not in 多欄位比對樣本,oraclesql

來源:互聯網
上載者:User

Oracle sql not in 多欄位比對樣本,oraclesql
select * from (select t2.cadastralno parcelid,t1.pkid taxpayerid,t2.taxtype taxtype,t1.booktype taxpayertype,
        t2.cadastralno parcelCadastralno,t2.landuser parcelLanduser,t1.payername taxpayerPayername 
         from grid_sysdb.bss_taxpayers t1,grid_sysdb.bbs_parcel t2,grid_sysdb.djsw_tddjxx t3 
        where t3.nsrdzdah = t1.pkid and t1.payername = t2.landuser)

        where (parcelid,taxpayerid) not in(select p.parcelid,p.taxpayerid from bss_parceltaxpayerrel p)


not in多個欄位


Oracle sql語句中not in有什作用

a not in(1,2,3) 意思是不等於 1,2,3(括弧所列的值)的所有的值, where a not in (1,2,3) 可以用 where a!=1 and a !=2 and a!=3 代替,執行結果完全相同。
 
怎用PL/SQL對oracle兩個表的資料做比對,建立oracle視圖結果集

例子:merge into test1 t1
using test2 t2
on (t1.id = t2.id)
when matched then
update set t1.name = t2.name
when not matched then
insert values(t2.id,t2.name)
--這個相當於條件判斷,這個例子的含義包括了update和insert,所以可以通俗理解為和檔案粘貼複製後直接替換一樣。
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.