Need to get order qty of the minimum ADATE
Im using below query and getting 12 records. Now I want to select orderqty of minimum ADATE which is 06-NOV-2018(2018-11-06). For every customer(will get multiple records), i need to get the Order_Qty of minimum ADATE column.
select
Customer ,
OrderID ,
LocationID ,
Order_Qty,Sent_date ,ADATE
from
(
select
OrderID ,
LocationID ,
Sent_date ,
Order_Qty ,
Customer ,
TimeStampA
from ARC_TBL
)
obn
inner join
(
select
ADATE ,TimeStampA
from trackTBL snt
)snt
on obn.TimeStampA = snt.TimeStampA
where Customer='ABC' and OrderID='XYZ100' and Sent_date='2018-11-18' and LocationID='250';