QUERY SEARCHING CLOSEST DATE
Posted on 2006-11-01
Hi, I'm searching the best and simplest way to make the following query:
I've got some SkU with specific dates. you can find multiple row with same sku, but with different date.
I want the closest date from today (getdate), but not greater.
ID SKU date
1 abc 01/01/2004
2 abc 01/01/2005
3 abc 01/01/2006
4 abc 01/01/2007
I want the row with ID 3, because the date is closest than date's row ID1 and ID 2.
ID 4's date is closest than ID 3's date but is greater than getdate so not good.
Thank you for your help.