Sherzy
3/17/2016 - 5:12 PM

Select where more than 1 row per column

Select where more than 1 row per column find duplicate rows

SELECT DISTINCT x. SchoolId, S.Name , [FirstName]
      ,[LastName]
  FROM [Advisor] x
  JOIN
     ( SELECT SchoolId FROM [Advisor] where IsActive = 1 and CompetitionTypeId = 1 GROUP BY SchoolId HAVING COUNT (0) > 1 ) y
    ON y.SchoolId = x.SchoolId
               left join [CTS].[dbo].School S  ON S.SchoolId = x.SchoolId
SELECT *
FROM DisplayBox
WHERE MAC IN (
                SELECT MAC 
                FROM DisplayBox
				WHERE Active = 1
                GROUP BY MAC
                HAVING COUNT(*) > 1
               )
Order by MAC



SELECT DisplayBoxId, DisplayName, IPAddress, LastUpdateTime
FROM DisplayBox
WHERE IPAddress IN (
                SELECT IPAddress 
                FROM DisplayBox
                GROUP BY IPAddress
                HAVING COUNT(*) > 1
                )