[RESOLVED] HELP needed with SQL querry!!!
Can anybody tell me why i am encountering the following problem with the follow SQL query when run in myPHPadmin:
Showing the error message:
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'
#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
Possibly the excess comma after 'directories'.'name'
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
LEFT JOIN files
ON directories.folder_id = files.folder_id
WHERE directories. user_id = 1
GROUP BY directories. folder_id
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)