0

I have 2 queries.
Query 1

delete b from automation1 b 
join report r
on b.Account_Number_Name = r.Account_Number
where b.StatementDate = r.StatementDate and
b.Cost = r.Cost and
b.ActualStartDate = r.StartDate and
b.ActualEndDate = r.EndDate and
b.Use = r.TotalUse
;

Query2

delete b from automation1 b 
join report r
on b.Account_Number_Name = r.Account_Number and
b.StatementDate = r.StatementDate and
b.Cost = r.Cost and
b.ActualStartDate = r.StartDate and
b.ActualEndDate = r.EndDate and
b.Use = r.TotalUse
;

what is the difference between this queries

Dhruv Kadia
  • 71
  • 1
  • 12
  • Not that I'm doubting you that you know your data, but how does this condition `b.Account_Number_Name = r.Account_Number` equate to true. – SS_DBA Jun 28 '17 at 17:08
  • I haven't read up on exactly how joins/wheres work, but I would think the second query would be a little faster since it is comparing all of the necessary columns as it is joining records and the first query is grabbing all of the records with matching account numbers and then filtering that down to just what you want. – CptMisery Jun 28 '17 at 17:18

0 Answers0