Is it possible to join two tables based on the same date, not factoring in time?
Something like:
...FROM appointments LEFT JOIN sales ON appointments.date = sales.date...
The only problem is it is a datetime field, so I want to make sure it is only looking at the date and ignoring time
You can do it like this:
FROM appointments
LEFT JOIN sales ON DATE(appointments.date) = DATE(sales.date)
But I'm pretty sure it won't be able to use an index, so will be very slow.
You might be better off adding a date column to each table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With