Dear All,
As per the attachement, I would like to know if we can get the difference of date if it in the same field
Unfortunately, the date is not in 2 fields,
Is it possible to know the difference of date in the same field
Thanks
Ludovic
Dear All,
As per the attachement, I would like to know if we can get the difference of date if it in the same field
Unfortunately, the date is not in 2 fields,
Is it possible to know the difference of date in the same field
Thanks
Ludovic
You need to get value from another record of same table? Review http://allenbrowne.com/subquery-01.html#AnotherRecord
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Thanks June7,
But this is really too complex for me to understand, unless you can do it in the attachment for me just to help me
LR
It was too complex for me when I first discovered but I spent time studying it and finally figured it out and believe me, it took more than an hour. Did you really make any effort?
But guess I can show off:
Try:
SELECT tblBDOrder.*, dtOrder - (SELECT TOP 1 Dupe.dtOrder FROM tblBDOrder AS Dupe WHERE Dupe.dtOrder<tblBDOrder.dtOrder ORDER BY Dupe.dtOrder DESC) AS ElapseDays
FROM tblBDOrder ORDER BY dtOrder;
Now if you want to know how many days between orders for the same customer:
SELECT tblBDOrder.*, dtOrder - (SELECT TOP 1 Dupe.dtOrder FROM tblBDOrder AS Dupe WHERE Dupe.dtOrder<tblBDOrder.dtOrder AND Dupe.txtCustomer = tblBDOrder.txtCustomer ORDER BY Dupe.dtOrder DESC) AS ElapseDays
FROM tblBDOrder ORDER BY txtCustomer, dtOrder;
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.