Tomasz Kasperczyk
Tomasz Kasperczyk

Reputation: 2093

Syntax error in a correct query while creating a view in phpMyAdmin

I'm trying to create a view from the following query:

SELECT 
    `Logs`.`ID`,
    `Logs`.`Date`,
    `Logs`.`Full log`,
    `Logs`.`Medium log`,
    `Logs`.`Minimal log`,
    `Machines`.`Name` AS `Machine name`
FROM 
    `Logs`
LEFT JOIN
    `Machines`
ON
    `Logs`.`Machine ID` = `Machines`.`ID`;

It works when executed in MySQL, but for some reason phpmyadmin doesn't allow me to create a view based on that query. I get the following error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AS SELECT 
    `Logs`.`ID`,
    `Logs`.`Date`,
    `Logs`.`Full log`,
    `Logs' at line 4

I have no idea why that error occurs because the query is correct.

Upvotes: 0

Views: 117

Answers (1)

Tomasz Kasperczyk
Tomasz Kasperczyk

Reputation: 2093

The problem was that phpmyadmin doesn't provide a default value for the view name if the "VIEW name" field is empty in the view configuration dialog. All I had to do was to enter the name of the view. In my opinion they should make that field mandatory.

Upvotes: 1

Related Questions