This is probably easy to do but I have a table which list items by price and has a version number for each item, so there is duplicate items with the same itemID and item name but the different versions might have different prices. I wanted a simple sql statement to check which items prices have changed
itemid | item | price |version | date
1 a 1.13 1 2011-12-01
2 b 5.13 1 2011-12-01
3 c 3.66 1 2011-12-01
4 a 1.03 2 2012-01-09
5 b 5.13 2 2012-01-09
6 c 3.33 2 2012-01-09
There will be numerous versions so guess I need to some kind of comparison function but not sure where to start in SQL.
So the above example I would only want to fetch back item a and c as there price has changed from the previous version.
Try:
Optionally include:
– if you only want to compare the specific versions 1 and 2.