I want to fetch table names from dba_tables using join with dba_tab_statistics.
select table_name
from dba_tables a,
dba_tab_statistics b
where a.owner like 'Owner' and a.table_name not like '%TMP'
and a.LAST_ANALYZED IS NOT NULL and a.table_name = b.table_name
and b.stattype_locked IS NULL;
This query doesn't give distinct table names. What changes are required ?
SELECT DISTINCT.JOINsyntax. Easier to write (without errors), easier to read (and maintain), and easier to convert to outer join if needed.