Can you demonstrate your issue with data? Please provide 2 sets:
A. Sample data from your table(s). Include table and field names and enough data to cover all cases.
B. Expected result of A. Show us what data you expect to end up with when you run the query.
Again, 2 sets of data--starting and ending.