i need a query in such a way that the qty of a item with respect to machine with its corresponding sdate and edates are consequtive is to be summed.