Subject | Re: [firebird-support] Simple Query? |
---|---|
Author | Helen Borrie |
Post date | 2003-06-18T04:50:35Z |
At 04:24 AM 18/06/2003 +0000, you wrote:
where j.EffDate = (select max(k.Effdate) from jobhist k
where k.Employee = j.Employee)
heLen
>I'm sure there is a simple solution but I just can't seem to find it.select j.Employee, j.Job, j.Salary, j.EffDate from jobhist j
>I need to select the most recent record for a particular employee
>thus.
>
>JobHist
>
>Employee Job Salary EffDate
>10000001 Supervisor 12,000 25-Oct-2002
>10000001 Manager 12,500 25-Oct-2001
>10000001 Supervisor 11,000 25-Oct-2000
>10000002 Manager 13,000 25-Oct-2002
>10000002 Supervisor 12,000 25-Jun-2002
>10000002 Assistant 10,000 20-Jan-2002
>...
>
>Required Result
>
>10000001 Supervisor 12,000 25-Oct-2002
>10000002 Manager 13,000 25-Oct-2002
>
>If I select Max(EffDate) and group by Employee I can't get the
>associated Job and Salary :(
where j.EffDate = (select max(k.Effdate) from jobhist k
where k.Employee = j.Employee)
heLen