如何在cakephp 4查询中使用'AS'?
How to use 'AS' in cakephp 4 query?
如何在cakephp查询中添加AS?
$table = $this
->find()
->select(['id', 'fname AS first_name'])
当我运行它
"查看与您的 MariaDB 服务器版本对应的手册,了解在 'AS "附近使用的正确语法
简单尝试:
$this
->find()
->select(['id'])
->select(['fname' => 'first_name']); // SELECT first_name AS fname
并阅读:
https://book.cakephp.org/4/en/orm/query-builder.html#selecting-data
如何在cakephp查询中添加AS?
$table = $this
->find()
->select(['id', 'fname AS first_name'])
当我运行它 "查看与您的 MariaDB 服务器版本对应的手册,了解在 'AS "附近使用的正确语法
简单尝试:
$this
->find()
->select(['id'])
->select(['fname' => 'first_name']); // SELECT first_name AS fname
并阅读:
https://book.cakephp.org/4/en/orm/query-builder.html#selecting-data