I'm trying to make this work but looks I'm doing something wrong, I've already looked around and can't find or figure out a solution! Sorry I'm just new on programing; Got 4 tables and I need to pull some information out :
From table 1 (worksheetsDetails):
I need the product_id product_designation and SUM(product_quantity) ordered by product_designation.
From Table 2 (worksheets): I need to get the worksheet_id from where the table 1 are related.
From table 3 (products): I need to get the product_price from products who are in the first table and pull a sum of all the products together where the table 4 (work_sites) worksite_id is related.
worksite_id from worksites is related to worksheets table.
I came this far:
SELECT 
    product_id, 
    product_description, 
    SUM(product_quantity) AS quantity 
FROM 
    app_com_worksheetDetails 
LEFT JOIN 
    app_com_worksheet
ON 
    app_com_worksheet.worksheet_id = pp_com_worksheetDetails.worksheet_id
WHERE 
    app_com_worksheet.worksite_id = '$wsi_id'       
GROUP BY 
    product_description"
And I'm getting that error!
Please someone can hepl?