Reputation: 115
I work at a small healthcare institution and I need to pull all of the providers for one of our clients and due to the way our system is setup I have to pull instances from the transaction log which shows complete and incomplete. I am getting it, but I want to hide duplicate patient_id's.
select
p.attending_id,
p.status,
p.patient_id
from patient_clin_tran p
where p.attending_id = 00000380
order by p.patient_id
A quick peak of my results looks like
00000380 CO 00000036
00000380 CA 00000036
00000380 CA 00000093
00000380 CA 00000093
00000380 CO 00000093
00000380 CO 00000093
00000380 CO 00000093
00000380 CO 00000093
00000380 CA 00000093
I do not want duplicate patient_id's showing up. I was hoping I could do order by distinct, but no go. I am a SQL noob just covering for someone, so I apologize if this is super easy. I will be putting this in crystal reports after to sort by status. If anyone knows how to make it, so I could make a crystal report that would ask me for attending_id before I open it that would be amazing, but I'll take what I can get. Thanks in advance!
Upvotes: 0
Views: 60
Reputation: 17981
try SELECT DISTINCT
explained here
http://www.w3schools.com/sql/sql_distinct.asp
Upvotes: 3