Need help in using distinct and rownum. In the sample SQL below I need to get distinct 100 rows. What is happening in my query is first the 100 records are selected and then it applies distinct which ends in giving less records in the output.
We join many tables and the database size is huge, so we want to restrict the query run on full population. Any solution available to get 100 distinct without theĀ query being executed for full population?
select distinct ename from emp
where rownum <=100