Alias syntax in FROM clause
Metalaka opened this issue · 5 comments
MySql throw a SQL syntax error when using from alias on a Select
request
#1064 - You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax
to use near 'o WHERE o.OBJ_ID = '…' ' at line 1
with request : SELECT OBJ_ID FROM (OBJECTS) AS o WHERE o.OBJ_ID = '…'
Why add parenthesis on line 223 of Hoa\Database\Query\SelectCore
? It work without.
$this->_from[$alias] = '(' . array_pop($this->_from) . ')';
I doesn't find examples with parenthesis on MySql and MsSql.
This is the syntax from mysql.com.
FROM tbl_name [[AS] alias]
I use MySql 5.5.
PS: there is no comma added between two FORM, this is because Hoa\Database is not finalized?
Hello :-),
What the SQL-2 standard says? This is our reference.
And can you give me an example for your “PS”?
+1 there's no reason to have parenthesis around the FROM table.
Yes it should.
When there are two or more table in from clause, the syntax should is FROM table1 AS a, table2