i have 2 tables first table is employ it have have 3 fields auto_id,employ_name,employ_pay then i have 2nd table hours with fields auto_id,employ_name,employ_hours,date_hours trying to write a query that can pick the time entered in data base sum up same employ hours multiply it from the pay rate then some up all the wages and show it code that i write till now its below but not working can some one plz help me with with code ty
SELECT SUM(s1.`employ_hours`) as `hours`, s2.`employ_pay` as `rate`, (`hours` * `rate`) AS `pay`
FROM `hours` s1
LEFT JOIN `employ` s2
ON s1.`employ_name` = s2.`id`
WHERE s1.`employ_hours` = 1
AND s2.`employ_pay` = 1
GROUP BY `employ_name` WITH ROLLUP