Does this give you what you need?
select * from hstread00 where digits(rdate)||digits(rtime) in
(select digits(rdate)||digits(max(rtime)) from hstread00 group by
rdate)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Smith,
Mike
Sent: Monday, March 30, 2020 10:50 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: [EXTERNAL] RE: sql troubles
Thanks for the reply
That doesn't seem to help much.
I still get both records for 20181212
SELECT prem, reading, rdate, max(digits(rdate)
concat(rtime)) FROM hstread00 WHERE rdate between
20181212 and 20190101 and batch <> 'OORTE' and prem = '100' GROUP BY prem,
reading, rdate order by prem, rdate
PREM READING DATE MAX
100 14,936.00 20,181,212 20181212100000
100 14,939.00 20,181,212 20181212110020
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Justin
Taylor
Sent: Monday, March 30, 2020 10:32 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] RE: sql troubles
Would this work:
select PREM, max( digits(RDATE) concat digits(RTIME) )
from hstread00
where rdate between 20181212 and 20190101 and batch <> 'ORTE' and prem =
'100'
group by PREM
-----Original Message-----
From: Smith, Mike [mailto:Mike_Smith@xxxxxxxxxxxxxxxx]
Sent: Monday, March 30, 2020 9:13 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: sql troubles
I am trying to select data from a history file. There may be multiple
records on a day, and I only want to select the record with the last time
for the each date in the date range.
PREM Batch RDATE RTIME
100 MR07 20181212 100000
100 MR07 20181212 110020
100 MR07 20181213 100000
101 MR08 20181212 100000
The basics are
Select * from hstread00 where rdate between 20181212 and 20190101 and batch
<> 'ORTE' and prem = '100'
I've can manage a single max date, or a single max time for the PREM, but I
need the max time for each date for each PREM
Any help 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.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.midrange.com%2fmai
lman%2flistinfo%2fmidrange-l&c=E,1,wfUZTw4DL2K4gtrv28OXCEXbA2fe1xBRMlK04AnbZ
QLQf5kNMVLipVqWbpvaIz3BQSdN97WFQNpVmJtYxFd1nUL-BXzpa8vTnGpuo70Voic6wgOJMPpnA
Rk,&typo=1
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2farchive.midrange.com%2fm
idrange-l.&c=E,1,SWvhizQYVRh03X9MxOsNVEmGjYGZ996wYt5PMWzMi8KNpCYbJACqNgn9Yho
jLIfiXGiFoavQ7rv6qjrww9r_xUkLHe52ccJtv9Ci51w6wKYclCt7ieXb1Aw,&typo=1
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmidrange.com&c=E,1,WgALE
grARGdLtO5Cg8rmCIKepAR9_0q-JFCSV-nwpnE7xvSfDcKWtdpRf4STIfV7uuizn9rpR_wJ2IL3-
9sZKKHPj0D0GYuC21ktg6h9OJFwUFEi&typo=1 by shopping at amazon.com with our
affiliate link:
https://linkprotect.cudasvc.com/url?a=https%3a%2f%2famazon.midrange.com&c=E,
1,Nus59IKUO894VnKMLibhMJMHT_rLEfEaEfcN6pNe_3dIENWF6mlLeqm4Su8UVVRP6LBno3tGbJ
U1gndoCSJ_Hwv0p44okoa7hj8eW7_InAA,&typo=1
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.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.