我有我希望按日期選擇記錄的情況,但是由於我需要爲其添加days_gap
,因此每條記錄的記錄選擇日期不同。根據每個記錄指定的日期分別選擇記錄
所以,我需要類似的東西:
`select from user_options where email_sent_at < time_now - days_gap`
這可能嗎?
DB結構: user_options
user_id | email_sent_at | days_gap
1 | 2016-07-27 | 2
2 | 2016-07-24 | 2
3 | 2016-07-22 | 5
4 | 2016-07-21 | 3
選擇從user_options其中email_sent_at
Bert
@Bert做出回答出來的共享伯特 – Drew