Can anybody tell me why i am encountering the following problem with the follow SQL query when run in myPHPadmin:
SELECT 'directories'.'folder_id', 'directories'.'timestamp', 'directories'.'name', LEFT ('directories'.'description', 30)as 'description' COUNT('files'.'file_id') as 'file_count'
FROM 'directories' LEFT JOIN 'files'
ON 'directories'.'folder_id' = 'files'.'folder_id'
WHERE 'directories'. 'user_id' = 1
GROUP BY 'directories'. 'folder_id'
Showing the error message:
#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 '.'folder_id', 'directories'.'timestamp', 'directories'.'name', LEFT ('directorie' at line 1
Thanks its sorted now, achieved it it by taking single quotes from around identifiers completely when pointing to them. My mistake didnt reliase:
SELECT directories.folder_id, directories.timestamp, directories.name, LEFT (directories.description, 30)as description, COUNT(files.file_id) as file_count FROM directories LEFT JOIN files ON directories.folder_id = files.folder_id WHERE directories. user_id = 1 GROUP BY directories. folder_id