I am a beginner in sql and I was wondering if you could help me figure out how to retrieve random records from Oracle. I have the following query:
SELECT p.* from data p where p.id in
(SELECT DISTINCT t.id FROM DATA t, comment c, PTV ptv
WHERE t.code not in ('x','y','Z')
and t.id = c.id(+) and ptv.code = t.code and ptv.code = t.code
and ptv.version = t.version AND t.TASK_CODE != 'DRAFT')
How can i select X number of random records from the results returned by the above query? Any suggestions will be appreciated.
(+)operator). Use an explicitJOINorLEFT JOINoperator. Even Oracle recommends to stop using the(+)operator.JOINoperator is that you can't accidentally create a cross join just because you forget the join condition. Plus there are things you can't do with the(+)operator compared to theLEFT JOINoperator (as I said: Oracle recommends to not use(+)any more)