0
$phql = "SELECT t1.* FROM (SELECT u.* FROM \App\Models\User as u) as t1";
$modelsManager = new \Phalcon\Mvc\Model\Manager();
$modelsManager->setDI($this->getDi());
$query = $modelsManager->executeQuery($phql);

Syntax error, unexpected token (, near to 'SELECT u.* FROM \App\Models\User as u) as t1', when parsing: SELECT t1.* FROM (SELECT u.* FROM \App\Models\User as u) as t1 (62)

What is the problem?

kenikori
  • 11
  • 3
  • Are you sure your table name is `\App\Models\User`? – Tpojka Apr 24 '16 at 11:58
  • Remove the first \ before `\App\Models\User`. So it becomes `App\Models\User`. I came across this issue once, and this solved it for me – Timothy Apr 24 '16 at 16:22
  • Also, the correct syntax for giving an alias to a table is `SELECT * FROM table_name alias_name` not `SELECT * FROM table_name as alias_name` ( so without the "as" ) – Timothy Apr 24 '16 at 16:25

0 Answers0