where date(time_stamp) = some_date
-----Original Message-----
From: Alan Shore [mailto:ashore@xxxxxxxx]
Sent: Wednesday, December 2, 2020 2:03 PM
To: Therrien, Paul <ptherrien@xxxxxxxxxxx>; Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Obtaining the last record for the day
Thanks for your reply Paul
I had an epiphany just after I sent the e-mail and I am heading down this same direction The one thing missing from your example is the highest timestamp for the day, not just the highest timestamp
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
-----Original Message-----
From: Therrien, Paul [mailto:ptherrien@xxxxxxxxxxx]
Sent: Wednesday, December 2, 2020 1:57 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: [EXTERNAL] RE: Obtaining the last record for the day
something like this:
select product, available_qty, time_stamp from myfile a where (product, time_stamp) in ( select product, max(time_stamp) from myfile b where b.product = a.product group by product);
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Alan Shore via MIDRANGE-L
Sent: Wednesday, December 2, 2020 1:12 PM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: Alan Shore <ashore@xxxxxxxx>
Subject: Obtaining the last record for the day
Hi everyone
We are on V7r3
We have a file that is an audit of the available quantity of products The fields are Product, time_stamp, Available_Qty I need to obtain the LAST record for a product within the same day For example Product time_stamp Available_Qty
5
2020-11-06-19.19.33.418000
6,469
6
2020-11-06-19.19.17.852000
1,645
35
2020-11-06-19.20.34.152000
1,595
65
2020-11-06-19.20.14.041000
1,522
70
2020-11-06-19.19.36.783000
4,433
70
2020-11-06-22.03.12.252000
4,431
91
2020-11-06-19.20.23.527000
8,890
Which would then result in
Product
time_stamp
Available_Qty
5
2020-11-06-19.19.33.418000
6,469
6
2020-11-06-19.19.17.852000
1,645
35
2020-11-06-19.20.34.152000
1,595
65
2020-11-06-19.20.14.041000
1,522
70
2020-11-06-22.03.12.252000
4,431
91
2020-11-06-19.20.23.527000
8,890
Hope this makes sense
Alan Shore
E-mail : ASHORE@xxxxxxxx<mailto:ASHORE@xxxxxxxx>
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
--
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@xxxxxxxxxxxxxxxxxxxx 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.