Kamis, 05 Februari 2015

[MS_AccessPros] Last test result query

 

I am trying to write a query that shows the last result for each patient,
the person nbr is the patient identified, the create timestamp would be the date range to identify the last test done it is a date/time field,
I have tried the last in totals but it is not returning the right amount of patients (I took the table to excel and sorted it to identify the correct result. Oh and I am looking for tests after a certain date (also date/time field)


this is the query I wrote,

SELECT dbo_wo_A1C_.person_id, dbo_wo_A1C_.A1_last_in_office_result, dbo_wo_A1C_.A1_last_office_result_dat, dbo_wo_A1C_.A1C_result, dbo_wo_A1C_.create_timestamp, dbo_wo_A1C_.enc_id, Last(dbo_person.person_nbr) AS LastOfperson_nbr
FROM dbo_person RIGHT JOIN dbo_wo_A1C_ ON dbo_person.person_id = dbo_wo_A1C_.person_id
GROUP BY dbo_wo_A1C_.person_id, dbo_wo_A1C_.A1_last_in_office_result, dbo_wo_A1C_.A1_last_office_result_dat, dbo_wo_A1C_.A1C_result, dbo_wo_A1C_.create_timestamp, dbo_wo_A1C_.enc_id
HAVING (((dbo_wo_A1C_.A1C_result)>0) AND ((dbo_wo_A1C_.create_timestamp)>#1/1/2014 0:1:0#));

Thank you for your help

__._,_.___

Posted by: pattykf@cox.net
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

.

__,_._,___

Tidak ada komentar:

Posting Komentar