My table has Product, Date, and Value on it. Each month the table gets updated with all current Products and their Value so one Product may be listed on the table 50 times. Most times the Value will be the same or slightly lower.
I am trying to query the table to catch times when the Value increased from the previous Date. I am looking to capture all 3 fields when this occurs.
Sample:
Product A, 10/01/2017, 100
Product A, 11/01/2017, 99.5
Product A, 12/01/2017, 100
Product B, 10/01/2017, 101
Product B, 11/01/2017, 101
Product B, 12/01/2017, 100
I would be looking to capture Product A, 12/01/2017, 100 because this row had the value increase from 99.5 to 100. I would not want to return any other rows for Product A because they decreased in Value. I wouldn't want any rows for Product B because they either decreased in Value or remained the same.
Any thoughts on how I can query the table to get the results I am looking for? Let me know if you have any questions. Thanks.
I am trying to query the table to catch times when the Value increased from the previous Date. I am looking to capture all 3 fields when this occurs.
Sample:
Product A, 10/01/2017, 100
Product A, 11/01/2017, 99.5
Product A, 12/01/2017, 100
Product B, 10/01/2017, 101
Product B, 11/01/2017, 101
Product B, 12/01/2017, 100
I would be looking to capture Product A, 12/01/2017, 100 because this row had the value increase from 99.5 to 100. I would not want to return any other rows for Product A because they decreased in Value. I wouldn't want any rows for Product B because they either decreased in Value or remained the same.
Any thoughts on how I can query the table to get the results I am looking for? Let me know if you have any questions. Thanks.