dprichard
07-15-2008, 06:03 PM
I am starting to hand code all my queries instead of letting Navicat write them and was wondering if I could simplify this so I don't have to say t1. AND t2. in the where clause. If I take away the AND t2, I get the first matching result versus the one I want. Any help would be greatly appreciated.
SELECT t1.empto_emp_id, t1.empto_id, t1.empto_renewal_term, t1.empto_prev_carry_over, t1.empto_max_carry_over, t1.empto_time_accrued, t1.empto_waiting_period , CONCAT(e1.emp_fname, ' ', e1.emp_lname) AS emp_name, t3.to_type_name
FROM
emp_time_table AS t1 INNER JOIN employee AS e1 ON t1.empto_emp_id = e1.emp_id,
emp_time_table AS t2 INNER JOIN to_type AS t3 ON t2.empto_to_type_id = t3.to_type_id
WHERE t1.empto_id = '$empto_id' AND t2.empto_id = '$empto_id'
SELECT t1.empto_emp_id, t1.empto_id, t1.empto_renewal_term, t1.empto_prev_carry_over, t1.empto_max_carry_over, t1.empto_time_accrued, t1.empto_waiting_period , CONCAT(e1.emp_fname, ' ', e1.emp_lname) AS emp_name, t3.to_type_name
FROM
emp_time_table AS t1 INNER JOIN employee AS e1 ON t1.empto_emp_id = e1.emp_id,
emp_time_table AS t2 INNER JOIN to_type AS t3 ON t2.empto_to_type_id = t3.to_type_id
WHERE t1.empto_id = '$empto_id' AND t2.empto_id = '$empto_id'