Excel Problem

AlaminK

New member
Local time
Today, 18:29
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.
 
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
 
using ADODB.Recordset.
 

Attachments

Users who are viewing this thread

Back
Top Bottom