Code: Select all
ID Date Article Price
1 2008-01-01 1 10
2 2008-01-02 2 20
3 2008-01-03 3 30
4 2008-03-01 1 11
5 2008-02-22 2 22
Code: Select all
SELECT TOP 1 * FROM "Prices" WHERE "Article"=1 AND "Date"<={d '2008-01-15'} ORDER BY "Date" DESC
Code: Select all
ID Date Article Price
1 2008-01-01 1 10
2 2008-01-02 2 20
3 2008-01-03 3 30
4 2008-03-01 1 11
5 2008-02-22 2 22
Code: Select all
SELECT TOP 1 * FROM "Prices" WHERE "Article"=1 AND "Date"<={d '2008-01-15'} ORDER BY "Date" DESC
Code: Select all
SELECT * FROM "Prices" WHERE ("Date" IN (SELECT MAX("Date") FROM "Prices" WHERE "Date"<=:X_Date AND "Article"=:Article)) AND "Article" =:Article