I need to come up with a case statement and I'm not sure if I should do it as part of the table join or in my select statement.
Bur when a Status is Price Reduced then I need to pull a price that was effective the day after an issue was closed.
If the Status was not equal to "Price Reduced" I need to take the first price change in the next 30 days and use that value.
If there was no difference, then I need to use "Null"
Any help you can provide would be great - Here is what I have so far and I tried it in the select statement but I get errors when I try to get the statement to evaluate the date range between.
ELSE NULL END AS p.PRICE,
asked Mar 22 '11 at 01:53 PM in Default
I try to keep the JOIN ON criteria limited to just those things that are needed to make the right matches between table rows, and do the filtering in the WHERE clause - it seems more logical that way, and, I think, makes for more maintainable code.
I'm sure this discussion has been had elsewhere here...http://www.google.co.uk/search?q=%2Bjoin+%2Bwhere+%2Bsite%3Aask.sqlservercentral.com