我在SQL新手和有問題希望你能幫助我:的Oracle SQL場
的Oracle 10g
表ACCOUNT
+----------+----------+ | ACCOUNTID| LBKEY | +----------+----------+ | ... | ... | | 254 | value254 | | ... | ... | | 401 | value401 | | ... | ... | | 405 | value405 | +----------+----------+
交叉引用表
+----------+----------+----------+--------+ | IDTABLE2 | ACCOUNTID| OIDID | VALUE | +----------+----------+----------+--------+ | ... | ... | ... | ... | | 475 | 401 | 4 | 40000 | | 476 | 405 | 4 | 35000 | | ...| ... | ... | ... | | 3000 | 254 | 5 | PARIS | | 3001 | 401 | 5 | LONDON | | 3002 | 405 | 5 | SYDNEY | | ...| ... | ... | ... | +----------+----------+----------+--------+
表OID
+----------+-------------+-------------+ | OIDID | OID | DESCRIPTION | +----------+-------------+-------------+ | 1 | x | x | | 2 | x | x | | 3 | x | x | | 4 | 1.3.6.1.4.1 | Post Code | | 5 | 1.3.6.1.4.2 | City | | 6 | x | x | | 7 | x | x | | 8 | x | x | | 9 | x | x | | 10 | x | x | +----------+-------------+-------------+
預期結果
約束:所有ACCOUNT(LBKEY)誰擁有交叉引用表
一個郵政編碼(OID 4)或城市代碼(OID 5)+----------+-------------+-------------+ | LBKEY | POST CODE | CITY | +----------+-------------+-------------+ | value254 | null | PARIS | | value401 | 40000 | LONDON | | value405 | 35000 | SYDNEY | +----------+-------------+-------------+
它就像一個魅力!非常感謝並祝聖誕快樂:) – juhnz
不是問題,對你也是聖誕快樂 - 如果這個(或者其他答案)回答了你的問題,那麼請接受它並/或者upvote(如果你有這樣的聲望)。 – MT0