0
SELECT
employees.emp_id,
employees.emp_name_en,
employees.emp_name_ar,
employees.emp_nike_name,
employees.emp_basic_salary,
employees.emp_aw_food,
employees.emp_aw_car,
employees.emp_aw_mobile,
employees.emp_aw_trans,
employees.emp_aw_housing,
((`settings`.`set_value` * `employees`.`emp_basic_salary`)/100) AS insurance_ratio,
(((((`employees`.`emp_aw_housing` + `employees`.`emp_aw_trans`) + `employees`.`emp_aw_mobile`) + `employees`.`emp_aw_car`) + `employees`.`emp_aw_food`) + `employees`.`emp_basic_salary`) - ((`settings`.`set_value` * `employees`.`emp_basic_salary`)/100) AS net_salary,
(net_salary/30) AS day_salary
FROM
employees ,
settings
WHERE
settings.set_key = 'insurance_ratio'
[錯誤] 1054 - 在 '字段列表' 未知列 'net_salary'MySQL不能用作查詢
我怎麼可以使用列 'net_salary'
你需要給整個代碼,而不是淨薪金 (((((('employees'.'emp_aw_housing' +'employees' .'emp_aw_trans')+'employees'.'emp_aw_mobile')+'employees'.'emp_aw_car')+'employees'.'emp_aw_food')+'employees'.'emp_basic_salary'' - - (('settings'.'set_value '*'employees'.'emp_basic_salary')/ 100)/ 30)AS day_salary – Pat