Excel Problem (1 Viewer)

AlaminK

New member
Local time
Today, 05:43
Joined
Apr 2, 2023
Messages
15
Hello,
I have attached an example of my problem that have been struggling for several days to solve.
Just need to find the respective <Price> from another Table2, matching the YarnID AND the closest <Created Date>
Please help.
 

ebs17

Well-known member
Local time
Today, 01:43
Joined
Feb 7, 2020
Messages
1,982
Query solution in Access
SQL:
SELECT
   T1.CreatedDate,
   T1.Yarn1,
   (
      SELECT TOP 1
         T2.Price
      FROM
         Table2 AS T2
      WHERE
         T2.Yarn = T1.Yarn1
            AND
         T2.CreatedDate <= T1.CreatedDate
      ORDER BY
         T2.CreatedDate DESC
   ) AS Price
FROM
   Table1 AS T1
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:43
Joined
May 7, 2009
Messages
19,246
using ADODB.Recordset.
 

Attachments

  • findprice.zip
    21.1 KB · Views: 61

Users who are viewing this thread

Top Bottom