Can I add more fields to a Query with the DateDiff Function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicole carnucc

    Can I add more fields to a Query with the DateDiff Function?

    I have a table that holds ALL of my data (patient name, address, block, appointment date, appointment comments, insurance company...).
    I ran a query off of that table to get the Most Recent appointment date, using the DATEDIFF function.
    When I try to add fields from my master table so that I can have the Patient's Name, Most Recent Appointment, Address, Ins. Co., and Appointment Comments all on the same Query, it gives me the information, BUT it displays patients' names and information multiple times (as many times as the amount of appointments they've had)...
    MY QUESTION is: How do I get the most recent appointment AND ADD the other information WITHOUT getting back the same records over and over again?
    Any and all help is appreciated!
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32661

    #2
    You need to start by organising your data properly in the first place. A database with that data all stored in a single table is just wrong. See Database Normalisation and Table structures for an insight into this issue.

    That said, a query will always return data in flat format. All records will contain all fields, just as you have them in your table at the moment. This you cannot change. What you can do though, is design a report to show the data in a form that is more appropriate, using different sections to show different data. That should do what you need.

    Comment

    Working...