I have a table with orders. Each order has a delivery_date, and a collection_date.
I want to retrieve the orders as a schedule for a week which shows what the next thing is to do.
So I guess I want the time sequence shown so that a collection on Wednesday appears in between a delivery on Tuesday and another delivery on Thursday.
Any ideas on how to do this with SQL?
Using a Union ALL, I’m treating each of your order records as two records: one for a delivery and one for a collection. If you had another date (repair?), you would union another sub query with similar fields.
I made up a lot of this since you did not provide any specs on your order table.