Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Max Date

Status
Not open for further replies.

pgh2377

Vendor
Jul 30, 2003
61
US
I have a table that stores a patients notes per date. For example, one patient may have 4 different notes(memo's) for four dates. Connecting to other tables, I'm trying to pull the last date so I can get the last memo. However each time I do it all the dates and memo's appear. I've tried max date but it does not work. Any suggestions?
 
Something like this:

SELECT P.PATIENTID, M.NOTES, M.MemoDATE
FROM PatientTable As P
INNER JOIN MemoTable As M on M.PatientID = P.PatientID where M.MemoDate = (SELECT MAX(MemoDate) FROM MemoTable M2 Where P.PatientID = M2.PatientID)

Leslie
 
Perhaps you could list your tables, their fields, the fields' data types. Then tell us specifically what you want to achieve. Once we have enough information, it should be easy to construct an sql.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top