I have a table that keeps records of the number of items. So every year the data gets updated at least once. So I want an sql statement that will display the data for only the latest for each year.
I tried using sub queries, views to compare the data ,Max (date), group by and stuff but can't seem to get it. Any guidelines?
Code:
ID------ItemCode----QTY-----Date
[COLOR="blue"]1--------A1------------20-------2000-03-02
2--------A1------------25-------2000-10-09[/COLOR]
[COLOR="green"]3--------A1------------30-------2001-03-07
4--------A1------------25-------2001-10-09[/COLOR]
5--------A1------------50-------2002-03-07
6--------A1------------65-------2003-03-07
7--------A2------------12-------2004-03-07
[COLOR="blue"]8--------A2------------12-------2005-03-07
9--------A2------------40-------2005-10-09[/COLOR]
I tried using sub queries, views to compare the data ,Max (date), group by and stuff but can't seem to get it. Any guidelines?