目前,我得到了这个:
SELECT `deals`.*, deals_bookings.date AS 'b_date', deals_bookings.id AS 'book_id'
FROM `deals_bookings`
INNER JOIN deals ON (deals.ID = deals_bookings.deal_id)
INNER JOIN users ON (users.id = deals.partner_id)
INNER JOIN deals_bookings_times ON (deals_bookings_times.book_id = deals_bookings.id)
WHERE 1 AND deals_bookings.date = CURDATE() AND users.company_type = 'restaurant'
这抓住了今天预订日期的交易 (CURDATE())。
现在我添加了一个专栏:deals_bookings.everyWeekDay
该列的计划是存储周数 -> 在 1-7 之间,其中 1 是星期一(一周中的第一天),7 是星期日。
是否可以通过纯 mysql 查询来选择所有具有 deal_bookings.date = CURDATE() 或如果 deal_bookings.everyWeekDay = todays week number 的交易?