|
Rob--
SELECT * FROM QTEMP/MSMITH where timestamp(digits(numdate) concat digits(numtime)) = (select max(timestamp(digits(numdate) concat digits(numtime))) from qtemp/msmith)
nice, gets the columns that go along with the latest date/time, which is probably the unstated driver <g>
also gets multiple records with the same latest date/time, if they exist thx & hth, --Jeromewould probably be adding another subselect level to get there with the other statement...
select * from logfile c where digits(c.logdate) || digits(c.logtime) = (select digits(a.logdate) || digits(max(a.logtime)) from logfile a group by a.logdate where a.logdate = (select max(b.logdate) from logfile b) ) On Aug 31, 2006, at 3:17 PM, rob@xxxxxxxxx wrote:
SELECT * FROM QTEMP/MSMITH where timestamp(digits(numdate) concat digits(numtime)) = (select max(timestamp(digits(numdate) concat digits(numtime))) from qtemp/msmith) ....+....1....+....2....+....3....+....4....+ LU AD OTH NUMDATE NUMTIME L ADMIN_BW CHISOMT 20,060,831 143,250 ******** End of data ******** Rob Berendt -- Group Dekko Services, LLC Dept 01.073 PO Box 2000 Dock 108 6928N 400E Kendallville, IN 46755 http://www.dekko.com Jerome Hughes <jromeh@xxxxxxx> Sent by: midrange-l-bounces@xxxxxxxxxxxx 08/31/2006 04:07 PM Please respond to Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx> To Midrange List <midrange-l@xxxxxxxxxxxx> cc Subject Re: [WDSCI-L] SQL getting record with last date/Time From: jromeh@xxxxxxx Subject: Re: [WDSCI-L] SQL getting record with last date/Time Date: August 31, 2006 2:44:24 PM CDT To: wdsci-l@xxxxxxxxxxxx Michael-- here's one way... select a.logdate, max(a.logtime) from logfile a group by a.logdate where a.logdate = (select max(b.logdate) from logfile b) thx & hth, --Jerome On Aug 31, 2006, at 2:34 PM, Smith, Mike wrote:L ADMIN_BW HARLESSD 20060830 155855 U ADMIN_BW CHISOMT 20060831 143021 L ADMIN_BW CHISOMT 20060831 143250 I need to do an sql select statement that will retrieve the highest date in a file, but also the highest time for that particular date. Originally I was just getting the latest date with a Select max(logDate). I then tried knowing it wouldn't work Select max(logdate), max(logTime). In the above records I would want 20060831- 143250 How would I accomplish this? Michael Smith iSeries.mySeries. -- This is the Websphere Development Studio Client for iSeries (WDSCI- L) mailing list To post a message email: WDSCI-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/wdsci-l or email: WDSCI-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/wdsci-l.-- This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l. --This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing listTo post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.