In a SQL Server table with Item, Supplier, Value and Date columns where are records of all item purchases, I need records, by item, with minimum value of the last 180 days only.
A sample table with only one Item:
Item | Supplier | Value | Date
---------------------------------------
123 | 28 | 115 | 2013-09-25
123 | 25 | 125 | 2013-11-30
123 | 30 | 120 | 2014-01-15
123 | 25 | 130 | 2014-04-30
The query result should be:
123 | 30 | 120 | 2014-01-15
It is possible have records that seems to be duplicated because it can be more than one origin document from the same supplier and date with same Item and value. Only need one of this records.
How can I get it?