Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL to retrieve min value of the combination
HRR wrote:
> Hi,
>
> I have the following table
>
> 1001 2 3
> 1001 3 5
> 1001 5 7
> 1002 5 4
> 1002 6 2
>
> I need to get a result
>
> 1001 2 3
> 1002 6 2
>
> How is it possible ?
Two thoughts. First ... this is school work and we don't do homework.
Second ... you have not provided any information as to what the criteria is for obtaining the result. Based on what you have asked the following query would meet your requirement.
SELECT *
FROM t
WHERE col1=1001
AND col2=2
AND col3=3
UNION
SELECT *
FROM t
WHERE col1=1002
AND col2=6
AND col3=2;
Which is as useless as it seems. So post your criteria ... don't make us guess ... and don't expect an answer if this is homework.
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Thu Jan 08 2004 - 09:46:35 CST