× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am working on a sql statement to get the record that has the highest date/time for a meter
I'm close, but when I try to include my reading data, I don't get the results I want.

So my data looks something like this filename "ReadingBatch)

HSTBATCH HSTMTR# HSTREAD HSTRDATE HSTRTIME
IMR07 66016 9,734 20,170,216 100,000
IMR07 66016 9,737 20,170,217 100,000
IMR07 66016 9,738 20,170,218 100,000
IMR07 66016 9,739 20,170,219 100,000
IMR07 66016 9,741 20,170,220 100,000
IMR07 66016 9,743 20,170,221 100,000
IMR07 66016 9,744 20,170,222 100,000
IMR07 66016 9,746 20,170,223 100,000
IMR07 66016 9,746 20,170,224 100,000
IMR07 66016 9,747 20,170,225 100,000
IMR07 66016 9,749 20,170,226 100,000
IMR07 66016 9,752 20,170,227 100,000
IMR07 66016 9,755 20,170,228 100,000
IMR07 66016 9,756 20,170,301 100,000
IMR07 66016 9,758 20,170,302 111,825
IMR07 66016 9,758 20,170,302 100,000
IMR07 101644 8,612 20,170,301 100,000
IMR07 101644 8,613 20,170,302 112,426
IMR07 101644 8,613 20,170,302 100,000

This is my current sql statement which appears to pick up the correct data, just not the HSTREAD field

SELECT HSTBATCH, max(concat(concat(hstrdate, ' '),hstrtime)) as HT,
HSTMTR# FROM readingbatch WHERE hstbatch
= 'IMR07' GROUP BY hstbatch, hstmtr#
ORDER BY hstmtr#

If I add the field HSTREAD I get too many records.

In this example what I want to end up with is

IMR07 66016 9758 20170302 111825
IMR07 101644 8613 20170302 112426

Any help is appreciated.

Mike


NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.