This topic is about a query I am running.
The query has three tables in it, one of which is a SQL view (Linked)
Within this view are the following fields:
Patient ID
Date Of Birth
GP Name
PCG Name
Start Date
Now, the problem that I am having is, to be brief, Duplicate Entries on the query, which show on the report that pulls off the query.
You see, a patient can have a patient ID, and be registered with a certain GP at a specific start date.
The patient can then be registered with ANOTHER GP at a different start date.
So, on my report I have a patient that is registered with 2 GP's.
I need to find a way to have only the Latest start date shown on the report, hence the patient will be shown with the correct GP.
I have tried using the MAX clause in SQL but it is getting too complex, I am sure this must be simple.
Any help would be appreciated.
Many thanks in advance,
-NEIL L POPE
The query has three tables in it, one of which is a SQL view (Linked)
Within this view are the following fields:
Patient ID
Date Of Birth
GP Name
PCG Name
Start Date
Now, the problem that I am having is, to be brief, Duplicate Entries on the query, which show on the report that pulls off the query.
You see, a patient can have a patient ID, and be registered with a certain GP at a specific start date.
The patient can then be registered with ANOTHER GP at a different start date.
So, on my report I have a patient that is registered with 2 GP's.
I need to find a way to have only the Latest start date shown on the report, hence the patient will be shown with the correct GP.
I have tried using the MAX clause in SQL but it is getting too complex, I am sure this must be simple.
Any help would be appreciated.
Many thanks in advance,
-NEIL L POPE