Re: Return last record



Thanks. I tried this and it worked to a degree. For some reason though it
is pulling more than just the Employee.ID I'm entering for the parameter.
It's pulling up 15 different employees even though I'm entering 2050 as the
Employee.ID. When I get this working right, the Employee.ID will be pulled
from the dropdown list on the form PastEmployeeSearch.

Any clue as to why it is giving me more than the parameter I entered? Here
is the SQL, although it is pretty much exactly what you typed:

SELECT *
FROM (tblEmployees INNER JOIN tblWage ON tblEmployees.EmployeeID =
tblWage.EmployeeID) INNER JOIN tblResignationTable ON tblEmployees.EmployeeID
= tblResignationTable.EmployeeID
WHERE (((tblWage.DateofChange)=(Select Max(W.DateofChange)
FROM tblWage as W
Where W.EmployeeID=tblEmployee.EmployeeID)));



"John Spencer" wrote:

> One method would be to use a subquery in the where clause
>
> SELECT *
> FROM (tblEmployee INNER JOIN tblResignation
> ON tbleEmployee.EmployeeID = TblResignation.EmployeeID)
> INNER JOIN tblWages On TblEmployee.EmployeeID = TblWages.EmployeeID
> WHERE tblWages.DateOfChange =
> (SELECT Max(W.DateOfChange)
> FROM tblWages as W
> WHERE W.EmployeeID = TblEmployee.EmployeeID)
>
>
> "Shanin" <Shanin@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:1B72FA23-5AC5-4E6F-B809-74039CB639DA@xxxxxxxxxxxxxxxx
> >I have a query that needs to pull the last wage information on seperated
> > employees. I have a form that one can choose from all past employees
> > listed
> > and it is supposed, emphasis on supposed to, to pull up that person
> > seperation reason and last pay, etc.
> >
> > The query is pulling off of three tables, tblEmployees, tblResignation,
> > and
> > tblWages. The EmployeeID is the primary key on all of these or part of it
> > since the wage table has the EmployeeID and DateofChange as the primary
> > key.
> > What the query needs to pull is the last name and first name and date of
> > hire
> > from the tblEmployee, the resignation date, reason, and if eligible for
> > rehire from tblresignation, and all the information that is associated
> > with
> > the last dateofchange in the tblWage, so basically their last day rate,
> > night
> > rate, title and status. Do I need to usa a SelectDistinct here?? I know
> > the
> > last function does not work since that will return whatever it feels like,
> > working sometimes and other times not.
>
>
>
.



Relevant Pages

  • Re: Technology solutions for Ruby?
    ... listed as a Rails app. ... Is there a reason for you not to? ... The project is to replace an existing desktop software solution targeted ... Their employees are spread all over the country, ...
    (comp.lang.ruby)
  • Re: Bill Gates says Im a pirate!
    ... Microsoft's thousands of employees have to pay for their clothing, cars, ... For that reason, they do not give their software away. ... Word Processing has BEEN invented. ... You might be incorrect in your assessment of MS's level of upset with pirates and smaller-scale violators of their copyright, trademark and other legal protections and rights under law. ...
    (microsoft.public.word.conversions)
  • Re: Any comments? (Answers to Pete)
    ... measure work done by off-site employees. ... Trust is very important. ... reason, I don't ask them why so I am ... I buy the whole team lunch when we achieve a milestone and I take ...
    (comp.lang.cobol)
  • Re: Fired without known cause
    ... very vague reason, and I asked them to explain and was refused. ... him I was making a claim to collect unemployment, ... I also felt like she sentenced me with termination. ... contracts may also protect employees. ...
    (misc.legal)

Loading