Results 1 to 2 of 2

Thread: Query to show only show the latest data

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Answers
    1

    Query to show only show the latest data

    Returning only the latest record in a one-to-many query. I have two tables, one called Prop the other called PropPerm. The PropPerm table holds permanent data about a property and the Prop table holds data that changes like owners, sale prices etc. How can i run a query which will only show the latest data in the Prop table. at the moment i am getting more than one record showing because it's showing all of the previous records related to that PropPerm id. I am using Access2003.

    Regards,
    greg


  2. #2
    Banned
    Join Date
    Dec 2007
    Answers
    2

    Re: Query to show only show the latest data

    SELECT *
    FROM tbl_prop
    WHERE tbl_prop.field_date >= getDate()-1
    ORDER BY tbl_prop.field_date DESC
    -----------------------------------------
    This will help you show the latest 24 hrs data, you can replace the -1 by -2 if you want to show the latest 48 hrs; and so on for -3 and -4 ...etc.
    -----------------------------------------
    the above code works in sql as well as access too in the query view mode.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact