Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: easy query (?)

Re: easy query (?)

From: MLJ <MLJ_at_INFOCOMINT.COM>
Date: 1997/03/10
Message-ID: <01bc2d42$d2334c80$e5a5cbc2@MLJ.emisis.com>#1/1

The statement :-

select city,time,temp
from table o
where time = (select max(time)

		from table i
		where o.city = i.city)

/

Alice Erickson <erickson_at_denebola.biostat.wisc.edu> wrote in article <5fpc1f$4c18_at_news.doit.wisc.edu>...
>
> I am trying to do what should be a simple query but doesn't seem to
> be so in SQL. Can someone give me a hint?
> Thanks,
> Alice
>
>
> I would like the final temperature reading for each city at the end of
 the
> day.
>
> EX.
> City Time Temp
> Boston 15:00 30
> Boston 24:00 10
> Phoenix 5:00 70
> Phoenix 6:00 72
>
> The resulting set should be
> Boston 24:00 10
> Phoenix 6:00 72
>
> but oracle will now allow you to use
>
>
> select city, max(temp), time from table
> group by city
>
> (as you are now also getting an aggregate of time)
>
>
  Received on Mon Mar 10 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US