This is such a simple SQL statement. So sorry for the question, but I can't
get it to work.
I'm trying to get a list of employees and the last time they worked on a
job. 
FIles are. 
employee file : with empl_num = employee number
job_history file : with empl_num,  job_num, and last_date = last date the
employee worked on a job
Each employee has worked many jobs during his employment . so employee to
job_history is 1 to many
The sql is very simple and for some reason I keep getting a error saying the
it can't reference stuff in the subselect to the file in the Select????? I
have it working in all my other databases.
-----------------------------------------------------
SELECT *
FROM employee
JOIN job_history 
ON   job_history.empl_num = employee.empl_num
AND job_history.last_date = (SELECT max(j1.last_date) 
FROM job_history as j1
WHERE j1.empl_num = employee.empl_num)
---------------------------------------------------------
Just to simple - so what am I doing wrong????

Thanks for the help..
Dan




-- 
View this message in context: 
http://www.nabble.com/subselect-tf3327306.html#a9250870
Sent from the SQLite mailing list archive at Nabble.com.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to