Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Tough SQL - min, max driven
TABLE01
JOB_ID number(10) PRIMARK KEY POSTCODE number(10) SUBURB_NAME varchar(50) PRIORITY number(10) JOB_TYPE varchar(50) STATUS varchar(30) START_TIME DATA END_TIME DATE ================================
In example above {2122, Albury}
(2) Get min(START_TIME)
In example above {10Oct2004}
(3) Get max(END_TIME)
In example above {31Dec2004}
(4) Get min(PRIORITY)
In example above {1}
-------- THEN THE HARD BIT --------
(4) Get {JOB_TYPE, STATUS} from row
that has min(PRIORITY)
In example it is {JobType02, Status02}
Couldn't figure out a decent SQL with joins and sub-queries. I'm trying to avoind going with a procedure/function.
Thanks & Cheers,
Gurram
Received on Fri Oct 14 2005 - 01:38:09 CDT