Showing last collected record in gridview

Joined
Oct 5, 2009
Messages
1
Reaction score
0
I have 2 SQL server tables

1. Bloodtest containing a list for valid bloodtests (bloodtestNumber) and descriptions (BloodWorkx)
2 PatientBloodtest containing the results captured for a specific patient (PatientBloodWorx)

Users capture blood test results at different times and they do not always capture all the bloodtests. ALL I want to do is to display the last blood test results captured for the patient in a gridview using this query

SELECT BloodWorx.BldTestName, PatientBloodWorx.membershipNumber,
PatientBloodWorx.BeneficiaryCode, MAX(PatientBloodWorx.BloodTestDate) AS LastOfbloodtestdate, MAX(PatientBloodWorx.BloodTestReceiveDate) AS LastOfBLOoDTESTRECEIVEDATE, MAX(PatientBloodWorx.BloodResult)
AS LastOfBloodresult FROM BloodWorx LEFT JOIN
PatientBloodWorx ON BloodWorx.BldNumber = PatientBloodWorx.BloodTest
GROUP BY BloodWorx.BldTestName, PatientBloodWorx.membershipNumber,
PatientBloodWorx.BeneficiaryCode, BloodWorx.BldNumber
HAVING (PatientBloodWorx.membershipNumber = @membershipNumber) AND (PatientBloodWorx.BeneficiaryCode = @BeneficiaryCode)

Can someone help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top