cfcProgrammer
Programmer
Hi Everyone,
Thanks in advance for any help you can provide.
I have a query that will bring back all the orders for a particular serial number but I only need to bring back the last order number and it's execution date. I'm not sure how to achieve this by using MAX(we do not have to use MAX but that is how I thought the data could be retrieved easily).
SELECT
ma.Id as 'Mobile ID'
,ma.[MobileType]
,ma.[CustomerId]
,ma.[ICCID]
,ma.[IMSI]
,ma.[Status]
,ma.[ARAccountCode]
,ord.OrderId as 'Last Order Number'
,ord.ExecutionDate
FROM Mobile ma, OrderDetails od, Order ord
where ma.ICCID = od.SerialNum
and od.OrderId = ord.OrderId
and ma.ARAccountCode in('xxx','abc','def','ghi','zzz')
order by ma.ARAccountCode, SerialNum, ord.OrderId
cfcProgrammer
Thanks in advance for any help you can provide.
I have a query that will bring back all the orders for a particular serial number but I only need to bring back the last order number and it's execution date. I'm not sure how to achieve this by using MAX(we do not have to use MAX but that is how I thought the data could be retrieved easily).
SELECT
ma.Id as 'Mobile ID'
,ma.[MobileType]
,ma.[CustomerId]
,ma.[ICCID]
,ma.[IMSI]
,ma.[Status]
,ma.[ARAccountCode]
,ord.OrderId as 'Last Order Number'
,ord.ExecutionDate
FROM Mobile ma, OrderDetails od, Order ord
where ma.ICCID = od.SerialNum
and od.OrderId = ord.OrderId
and ma.ARAccountCode in('xxx','abc','def','ghi','zzz')
order by ma.ARAccountCode, SerialNum, ord.OrderId
cfcProgrammer