select emp_name,emp_dept_id,emp_empl_id,emp_dept_name=(select dp_description from t_department where dp_dept_id=emp_dept_id) from t_employee where emp_empl_id='"&replyname&"'
其中emp_dept_name为用户自定义变量,不可与t_employee中字段相同.
另外一种方法
select t_employee.emp_name,t_employee.emp_dept_id,t_department.dp_description from t_employee,t_department where t_employee.emp_empl_id='"&replyname&"' and t_employee.emp_dept_id=t_department.dp_description