Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    New Jersey
    Posts
    103
    Thanks
    6
    Thanked 0 Times in 0 Posts

    SQL Statement (SQL)

    Can someone help with this statement?

    SELECT DISTINCT plh.PersonGUID FROM tPersonLocationHist plh INNER JOIN tlocation l
    ON plh.LocationCode = l.LocationCode
    WHERE plh.LocationCode in ('6000000')

    The problem I am having is that the statement is pulling employees who at one time resided at location 6000000. What I want is for the statement to look at the top most record and give me anyone who is in 6000000.

    Help.
    Thank you!!!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SQL Statement (SQL)

    Shouldn't this be in the Access forum?

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SQL Statement (SQL)

    What defines the 'topmost' record? Tables in a database aren't stored in any particular order, so you must specify a field or fields to sort on.

    Why do you need the tlocation table in this query?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •