Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> SQL Join or Subquery
All...
I have a question about a query over which I've been racking my brain for weeks, and I can't find a reference to adequately assist me.
Given a table of temperature sensors, and a table of readings from those sensors, how might I grab the max (hence latest or current) temperature reading for each sensor? The relevant fields in the tables are timestamp and temp_c (temperature table), and sensorid (both temperature and sensor tables).
I'm fairly certain that I'm overlooking something very elementary, and I feel it should be simple and straightforward, but I think I'm being stymied by the use of aggregate functions in my query. I can provide examples of my failed attempts, if you'd like. Thanks in advance for any assistance you can provide.
Gary Chambers
//-------------------------------------
//-------------------------------------
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Gary Chambers INET: gc22_at_lucent.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Wed Jul 17 2002 - 16:54:14 CDT