Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Posts
    2

    Question Unanswered: using cross tbl queries

    Hi

    I'm struggling with a crosstab query I have created to select the last two sets of data from a tbl. The tbl has the following fields

    Veh_Reg
    Date
    ODO Reading

    What I am attempting to do is select the last two records for each Veh_Reg to allow me to calculate the difference between the first and the last date.

    Any help or suggestions on how to extract this data out of the tbl would be appreciated, as it is driving me mad!!!!!

    Thanks,

    J

  2. #2
    Join Date
    Apr 2004
    Location
    metro Detroit
    Posts
    634
    create a group by query to get the first and last (prob a min and max on odo reading). Then create another query using the group by query as the source.

  3. #3
    Join Date
    Apr 2006
    Posts
    2

    Question

    okay... but would that work if every record has a uniqueness. Each Veh_Reg could have multipul odo readings over several weeks, meaning that I would only want to select the last two records.

    Also would this multipul data entry against a Veh_Reg mean that the group by query would fail?

    Is there no way of using a select qry to bring up the last two records for every vehicle reg??

  4. #4
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I believe this is what you will want:

    http://support.microsoft.com/kb/210039/en-us

    Check out Method 1. You should be able to get the last two readings with the Top 2 if you order it by the date of the reading.

Posting Permissions

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