I have a table with data for customers. Each entry has a specified customer and a start date and an end date. I want to display specific customer data that has startdate between two variables, i.e. i ask the user on the frontend to choose 1. a customer and 2. startdate to start somewhere between x and y. So that the displayed data doesn't take the end date into account because it's more important to see what data is starting in that time range and not what data is ending.
I used to do this like this:
WHERE c2c.CUSTOMER LIKE '%". $customers ."%' AND (MASTER.MASTER_SCHEDULED_START_DATE >= '". $datumanf . "' AND MASTER.MASTER_SCHEDULED_START_DATE <= '". $datumend . "') This looked like it worked! Until I noticed that it only displays data where the start date and the end date are on the same day.
After researching on Stackoverflow I tried MySQL BETWEEN
WHERE c2c.CUSTOMER LIKE '%". $customers ."%' AND (MASTER.MASTER_SCHEDULED_START_DATE BETWEEN '". $datumanf . "' AND '". $datumend . "') But this still somehow takes the end date into account, for it shows the exact same results as before: Only those where the startdate and the enddate are on the same day and between that defined range. I don't understand this because I don't use the end date at all in this query.