Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Tough SQL - min, max driven
scott_at_ORA92> SELECT * FROM table01
2 /
JOB_ID POSTCODE SUBURB_NA PRIORITY JOB_TYPE STATUS
START_TIM END_TIME
---------- ---------- --------- ---------- ---------- --------
scott_at_ORA92> SELECT postcode,
2 suburb_name, 3 MIN (start_time) AS min_start, 4 MAX (end_time) AS max_end, 5 MIN (priority) AS min_priority, 6 MAX (job_type) KEEP 7 (DENSE_RANK FIRST ORDER BY priority) 8 AS job_type, 9 MAX (status) KEEP 10 (DENSE_RANK FIRST ORDER BY priority) 11 AS status
POSTCODE SUBURB_NA MIN_START MAX_END MIN_PRIORITY JOB_TYPE STATUS
---------- --------- --------- --------- ------------ ----------
2122 Albury 10Oct2004 31Dec2004 1 JobType02 Status02
scott_at_ORA92> Received on Fri Oct 14 2005 - 22:38:16 CDT