Lets say I have 2 tables one called EMP_INFO and another called ACTIVITY linked one to many by EMP_INFO.EMP_ID to Activity.EMP_ID. I want to return all the employees with there info and the last time they logged on. Assuming that I want to pull all the empoyees info and only the greatest value of logged_on for each employee how can this been done. I triend
"select emp_info.*, max(activity.logged_on) from emp_info join activity on emp_info.emp_id = activity.emp_id" but that is not accepted because max(activity.logged_on) is just wanting to pull the largest value on logged_on and not the largest value for logged_on for each employee in emp_info. How can this be re-wrote to work?
2007-01-10
06:24:31
·
2 answers
·
asked by
csdraska
1
in
Computers & Internet
➔ Programming & Design