How can I delete duplicate rows in SQL. Here is the current query. Select EmployeeID, Username,
How can I delete duplicate rows in SQL. Here is the current query.
Select
EmployeeID,
Username,
FirstName,
LastName,
RoleName,
RoleDescription,
Count(*) as '# of Duplicates'
From
[dbo].[vw_MyAccessInfo]
Group by EmployeeID, Username, FirstName, LastName, RoleName,RoleDescription
Having Count(*) > 1
Delete from [dbo].[vw_MyAccessInfo]
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
This query is not correct as I'm still receiving this error.
Msg 4145, Level 15, State 1, Line 15
An expression of non-boolean type specified in a context where a condition is expected, near ','.
Msg 102, Level 15, State 1, Line 17
Incorrect syntax near ')'.
Here is the query provided by you.
The query provided is giving me errors (see below). Can you assist?
Msg 4104, Level 16, State 1, Line 5
The multi-part identifier "x2.id" could not be bound.
Completion time: 2022-08-09T11:32:00.7475729-05:00