キュアセブン技術ブログ

考えたこと,学んだことを書きます

Error: SQLSTATE [23000]: Integrity constraint violation: 1052 Column 'hoge_id' in where clause is ambiguous

PDOException

Error: SQLSTATE [23000]: Integrity constraint violation: 1052 Column 'hoge_id' in where clause is ambiguous

みたいなエラーがでた。

controllerでデータベースを指定してなかった。

{テーブル名}.hoge_idにするか、そのテーブルのカラムなら$this->aliasField('hoge_id')にすると直った