i have a table with billions of records which is holding Merchandise information as follows. ID is bigint with auto increment. Article, UPC and MRP is actual data. DataDate is having the information like from which date this MRP is applicable.
ID Article EANUPC MRP DataDate
8546417 20171554001 1220636 599 20/11/2015
18589213 20171554001 1220636 599 15/12/2017
18655485 20171554001 1220636 390 26/12/2017
18784953 20171554001 1220636 390 11/1/2018
18833697 20171554001 1220636 290 16/1/2018
18954190 20171554001 1220636 290 24/1/2018
19060047 20171554001 1220636 190 30/1/2018
19116702 20171554001 1220636 90 6/2/2018
20107113 20171554001 1220636 90 13/6/2018
20143100 20171554001 1220636 599 13/6/2018
i want to merge the records in such a way that if MRP is same for subsequent days. then it should show valid from and Valid To date for that MRP.
i require following output.
Article EANUPC MRP FromDate ToDate
20171554001 1220636 599 20/11/2015 25/12/2017
20171554001 1220636 390 26/12/2017 15/01/2018
20171554001 1220636 290 16/1/2018 29/01/2018
20171554001 1220636 190 30/1/2018 05/02/2018
20171554001 1220636 90 6/2/2018 12/06/2018
20171554001 1220636 599 13/6/2018 24/08/2018
Please help me to achieve this.