SQL LanguageSQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Now as far as i can see you are required to retrieve last 4 records up to a specific date.And if this is the case then all you have to do is to use the ORDER BY and WHERE clauses as needed:
EXAMPLE
SELECT * FROM
TRANSACTION
WHERE ValidThru >= 14-2-2007 0:10:27
ORDER BY ValidThru;
---------------------------
Try out this query, hope it helps and if you are still stuck then reply me back.