0
SELECT PatientID as 'PatientIDIX', claims.ClaimID as 'ClaimIDIX', ClaimThroughDate as 'ClaimThroughDateIX', HCPCCode, ProcedureID
FROM `t1`.revenue revenue   
JOIN `t1`.patient patient ON revenue.ClaimID = patient.ClaimID   
JOIN `t1`.claims claims ON claims.ClaimID = revenue.ClaimID
LEFT JOIN `t1`.procedures procedures ON procedures.ClaimID = revenue.ClaimID
WHERE HCPCCode IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
OR ProcCode IN (11, 22, 33, 44, 55, 66, 77, 88, 99, 1010);

I was wondering if anyone has some insight into why the above query is taking so long. I believe it is because of the left join. Thanks!

ChrisYee90
  • 389
  • 1
  • 6
  • 12

1 Answers1

0

I found a few articles that may help you:

Depending on your data, indexing and other factors, the simplest solution may be to use a temp table instead of using the IN statement.

Community
  • 1
  • 1
Vin Vill
  • 24
  • 5