Hey Guys i want to thank you again for all the support you rendered it make my coding skill improve and i keep learning more and more.
I have a challenge i am trying to retrieve patient record when the patient enrollement ID is found from a View called "HIVENCOUNTER" let me show it with Table
tbl_HIVENCOUNTER
| Ptn_pk | PatientID | Drug | Duration | Wieght | VisitID | VisitDate | ||
| 00245 | 101001 | ART | 30 | 140 | 111 | 10/01/2001 | ||
| 00245 | 101001 | ART | 60 | 100 | 122 | 05/02/2001 | ||
| 00245 | 101001 | ART | 30 | 110 | 212 | 03/03/2001 | ||
| 00246 | 101002 | ART | 90 | 120 | 121 | 12/01/2001 | ||
| 00246 | 101002 | ART | 30 | 150 | 1414 | 06/02/2001 | ||
| 00246 | 101002 | ART | 120 | 60 | 1415 | 10/03/2001 |
Based on the above table i want to retrieve record as follows :
select * from tbl_HIVENCOUNTER t
Inner Join mst_patient p on t.Ptn_pk = p.Ptn_pk and p.PatientID = '101001'
order by t.VisitDate Asc
it return just two record instead of three as following :
| Ptn_pk | PatientID | Drug | Duration | Wieght | VisitID | VisitDate |
| 00245 | 101001 | ART | 30 | 140 | 111 | 10/01/2001 |
| 00245 | 101001 | ART | 60 | 100 | 122 | 05/02/2001 |
i also modify the script like this
Select * from tbl_HIVECOUNTER t where t.Ptn_pk = (Select ptn_pk from mst_patient where PatientID = t.PatientID) order by t.VisitDate
this also is returning the same result, i am implementing this code with C# loop "While loop"
Note : mst_Patient is the master patient table that contain the demographic record of each Patient
any suggestion will be appreciated. Thank you all

Manish KumarPosted Dec 8, 2016, 5:29 AM
Bikesh SrivastavaPosted Nov 10, 2016, 11:54 PM
Tapan PatelPosted Nov 10, 2016, 11:31 AM