is this something that's possible to achieve in Ms. Access?
I have two table, first table is a calculated product requirement:
Second Table is the fixed adjusted rate specific to each product (since there's a fix output rate from the equipment we used to apply the product and have to split them in a very specific rate)
The goal would be to generate this table (so I can link it to the table 2 and get a specific split rate required by the equipment)
I have been cranking my head for hours but couldn't find a solution yet. Any help would be appreciated :)
CodePudding user response:
Consider:
SELECT Table1.*, Table2.* FROM Table1
INNER JOIN Table2 ON Table1.Product = Table2.Product
WHERE Table2.Adjusted = (SELECT TOP 1 Adjusted FROM Table2
WHERE Table1.Calculated <= Table2.Adjusted);
CodePudding user response:
You can also try below query-
Select t.product, MIN(t.adjusted) as Adjusted from
(SELECT t1.Product, t2.Adjusted
FROM Table1 as t1 INNER JOIN Table2 as t2 ON t1.Product = t2.Product
WHERE (t2.Adjusted>t1.calculated)) as t Group by t.Product;