Issue
How to add AS in cake php query?
$table = $this
->find()
->select(['id', 'fname AS first_name'])
When i run it "check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS "
Solution
Simple try:
$this
->find()
->select(['id'])
->select(['fname' => 'first_name']); // SELECT first_name AS fname
and read:
https://book.cakephp.org/4/en/orm/query-builder.html#selecting-data
Answered By - Salines
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.