sql - need an oracle query joining 2 tables with 2 conditions -
i have master table
select * table_master pkid empno name
1 101 aaa
2 102 bbb
3 103 ccc
select * table_txn txn_pkid master_fkid empno remarks
1 1 101 na
2 2 500 wrong entry
3 3 123 wrong entry
i need query fetch records:
2 2 500 wrong entry
3 3 123 wrong entry
something like:
select * table_master a, table_txn b a.pkid = b.txn_pkid a.empno <> b.empno
i think logic works fine join:
select t.* table_txn t join table_master m on t.txn_pkid = m.pkid , t.empno <> m.empno ; your code sample work if replaced but and. however, don't use implicit joins. explicit joins introduced in sql more 2 decades ago; explicit syntax clearer, more powerful, , accepted databases.
Comments
Post a Comment