www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] HELP needed with SQL querry!!!

  1. #1
    Join Date
    Aug 2011
    Posts
    22

    resolved [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:

    Code:
    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

  2. #2
    Join Date
    Feb 2012
    Location
    Tallahassee, FL
    Posts
    280
    Possibly the excess comma after 'directories'.'name'

  3. #3
    Join Date
    Aug 2011
    Posts
    22
    Thanks its sorted now, achieved it it by taking single quotes from around identifiers completely when pointing to them. My mistake didnt reliase:

    PHP Code:
    SELECT directories.folder_iddirectories.timestampdirectories.nameLEFT (directories.description30)as descriptionCOUNT(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 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles