How can I remove duplicate rows from my table? I've searched the Internet, but I haven't been able to solve the issue. Here's what I've written:
WITH C As
(
Select A.PatientID, A.DoctorID
From Appointment As A
)
Select Distinct A.PatientID, A2.PatientID, A.DoctorID
From Appointment As A
Inner Join C as A2
On A.DoctorID = A2.DoctorID
Where A.PatientID <> A2.PatientID
Order By A.PatientID Asc
Here's the outcome:
In the image above, you'll notice that the data in row 1 is duplicated in row 6. How can I remove all the duplicate rows? Any suggestions?
