Advertisement
Guest User

Untitled

a guest
May 24th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. SELECT vs.* FROM (
  2. SELECT CompanyID,BranchID,CustomerID,VisitDate FROM dbo.DMSVisitPlan
  3. WHERE CompanyID =3
  4. GROUP BY CompanyID,BranchID,CustomerID,VisitDate HAVING COUNT(CustomerID) > 1) dup
  5. JOIN DMSVisitPlan vs ON vs.CompanyID = dup.CompanyID
  6. AND vs.BranchID = dup.BranchID
  7. AND vs.CustomerID = dup.CustomerID
  8. AND vs.VisitDate = dup.VisitDate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement