title: How can i remove duplicate rows with in my sql server database
body: <p><a href="https://i.stack.imgur.com/sThnS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sThnS.png" alt="enter image description here"></a></p>
  
  <p>I have this table of attendance system with columns dateinout, checkin, checkout etc. user punch in when come to office and punch out when go out. system retrieve data two time from fingerprint scanner machine. I want to delete rows with more than one count in same date where punch in is between 7am to 11 am also the rows with check out with same date in between 11 am to 6 pm.</p>
  
  <pre><code>    SELECT
      a.Logid, 
      a.Userid, 
      a.CheckTime,  
      a.Name  
  
  FROM Checkinout a 
  JOIN
  (SELECT
      userid,
      name,  
      dateinout,  
      Intime,
      Outtime
  
      FROM att
      WHERE Intime BETWEEN '07:00:00.0000000' AND '11:00:00.0000000'
      AND userid= 37
      GROUP BY userid, dateinout, Intime, Outtime, name
      HAVING COUNT(Intime)&gt;1) b
      ON a.Userid= b.userid
      ORDER BY CheckTime ASC;
  </code></pre>