私はzf2プロジェクトでtablegatewayステートメントを実装しましたが、今年mysql year関数を使用したときに問題が発生しました。これは私のコードZend Framework 2エラー:テーブルゲートウェイで年機能を実装したときにステートメントを実行できませんでした
コードです:
$where = new Where();
$classYearMin = $classYear - 1;
$where->greaterThanOrEqualTo('year(date_a)', $classYear)
->and
->equalTo('id_type',1)
->and
->notEqualTo('semester_type','concat("B_","'.$classYearMin.'","/","'.$classYear.'")');
$sql= $this->tableGateway->select(function (Select $select) use ($where) {
$select
->columns(array('semester_type'))
->order('date_a')
->where($where);
});
と私のmysql
出力構文:
構文:
select semester_type
from skedul
where year(date_a) >= 2010
and id_type = 1
and semester_type != concat('B_',2010-1,'/',2010)
order by date_a;
とエラー出力
声明は(42S22 - 1054 - 不明な列 '年
(
date_a`')を実行することができませんでした 'where句' 内)
は、誰も私を助けることができますか?おかげさまでありがとう私の悪い英語のためにごめんなさい
MySQLの出力構文を解決する
希望は私が「、2010-1、skedul年(date_a)> = 2010とID_TYPE = 1からsemester_typeを選択し、semester_type!= CONCAT( 'B _' '希望しました/ '、2010)order by date_a; – edrianhadinata