473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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!
Nov 15 '10 #1
1 1088
NeoPa
32,556 Expert Mod 16PB
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.
Nov 17 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: PMBragg | last post by:
ORINGINAL Post >Thank you in advance. I'm trying to pull all inventory items from December >of the previous year back to 4 years for my accountant. I know this can be >done, but I'm drawing a...
1
by: info | last post by:
Can some one show me how to use the datediff function where the dates are being supplied through an access db. For instance, a recordset would contain these fields: DateAssigned, DateDue,...
5
by: mcbill20 | last post by:
Hello all. I have a really basic question that I hope someone has a better answer for. I apologize in advance-- I know this is probably a really basic question but I am used to Oracle rathern than...
2
by: Derrick | last post by:
I've included using Microsoft.VisualBasic, cranked up a VBCodeProvider, the only class I see in there, don't see DateDiff as a method though? Thanks in advance!! Derrick
7
by: reney | last post by:
I am trying to return the difference in minutes from a starttime and stoptime using the datediff function in a Web Project with VB.Net With: StartTime = 2/10/2006 8:46:03 PM EndTime = ...
4
by: misaw | last post by:
for portability in SQL query ie a query written for one DB runs fine for other i try to standardize our SQL queries as far as i can.... For finding the date difference we have: DATEDIFF...
7
by: JenM | last post by:
Hi. I am a novice user. I am using the datediff function in a query. I am trying to calculate the number of week days between two dates. When I use "m" as the interval, the number of weeks is...
14
by: cmdolcet69 | last post by:
I'm trying to use the DateDiff function to calculate the difference whether a shift has been setup. when i run the code below with strFirstShiftEnd as a stringor date or datetime. I get an error...
1
by: cptcanada | last post by:
Hi All, I am getting an error saying that now() is not a reconized function in my datediff function would any one know why it is not being reconized? Thanks for the help...
2
by: bandy | last post by:
Hi, I am using datediff() function to get difference between two dates. my code looks like, function dateDiff($dformat, $endDate, $beginDate) { $date_parts1 = explode($dformat,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.