【发布时间】:2018-03-23 05:55:20
【问题描述】:
我必须运行MYSQL 选择查询,其中查询返回开始日期为今天之后 10 天的所有值。这两种方法我都试过了,似乎都不起作用,我需要在哪里进行更改?
$fix_d_table = TableRegistry::get('fixed_departures');
$f_dates_march = $fix_d_table ->find("all")
->where(['trek_id' => 3])
->andWhere(['month(date_from)' => 03])
->andWhere(['date_from' >= date("Y-m-d",strtotime("+10 days"))])
->order(['date_from'=>'asc'])
->select(['date_from', 'date_to', 'seats_available','id'])
->toArray();
$fix_d_table = TableRegistry::get('fixed_departures');
$f_dates_march = $fix_d_table ->find("all")
->where(['trek_id' => 3])
->andWhere(['month(date_from)' => 03])
->andWhere(['date(date_from)' >= date("Y-m-d",strtotime("+10 days"))])
->order(['date_from'=>'asc'])
->select(['date_from', 'date_to', 'seats_available','id'])
->toArray();
【问题讨论】:
-
我很想在原始 MySQL 中找到一个有效的查询,并重新设计它以适合您的框架
标签: php mysql sql datetime cakephp