Anda dapat menulis ulang kueri ini dengan sintaks gabungan seperti:
SELECT DISTINCT t.table_id
FROM TABLE_ONE t
JOIN COMMON_TABLE cmn
ON t.table_id = cmn.common_id
WHERE t.table_name IN( 'TEST_ONE', 'TEST_TWO', 'TEST_THREE' )
AND cmn.column_one > 20
AND cmn.column_two <= 30
DISTINCT
akan menghapus catatan duplikat.
EDIT:
Anda dapat memasukkan tabel anak Anda seperti :
SELECT DISTINCT t.table_id
FROM TABLE_ONE t
JOIN COMMON_TABLE cmn
ON t.table_id = cmn.common_id
JOIN TABLE_CHILD_ONE tc
ON t.table_id = tc.table_id
WHERE ( tc.table_name IN( 'TEST_CHILD_ONE', 'TEST_CHILD_TWO', 'TEST_CHILD_THREE' )
OR t.table_name IN( 'TEST_ONE', 'TEST_TWO', 'TEST_THREE' ) )
AND cmn.column_one > 20
AND cmn.column_two <= 30