Code: Select all
select ComputerName, UID
from tbl_PurgeTestData
group by ComputerName
having count(ComputerName) > 1
Column 'tbl_PurgeTestData.UID' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I have two queries that I believe can give me what I need, I just can't figure out how to make the join work.
This one:
Code: Select all
SELECT *
FROM tbl_PurgeTestData
WHERE DATEDIFF(day, LoginTime, GETDATE()) > 3
ORDER BY LoginTime DESC
And this one:
Code: Select all
SELECT ComputerName
FROM tbl_PurgeTestData
GROUP BY ComputerName
HAVING COUNT(ComputerName) > 1
ORDER BY ComputerName