Hi
How would you code a query in T-SQL where you were looking for the nearest match.
As an example - assume that you have a Product table and a Year table. Each product has a year. However not every year is populated, in the Year table.
Therefore assume that every year between 1980 and 1990 except for 1984 is populated in the Year table
If a Product's year was 1983, I would want it to join to the 1983 row in the Year table. However, if a Product's year was 1984, I would want it to join to 1983 as there isn't a 1984 row.
Thanks
Mark
How would you code a query in T-SQL where you were looking for the nearest match.
As an example - assume that you have a Product table and a Year table. Each product has a year. However not every year is populated, in the Year table.
Therefore assume that every year between 1980 and 1990 except for 1984 is populated in the Year table
If a Product's year was 1983, I would want it to join to the 1983 row in the Year table. However, if a Product's year was 1984, I would want it to join to 1983 as there isn't a 1984 row.
Thanks
Mark