write a query to delete similar records in same table
Answer Posted / manjla
CREATE TABLE User_Details
(
UserID int ,
FName varchar (50),
MName varchar (50),
LName varchar (50),
Email varchar (50)
)
insert into User_Details values(1,'X','Y','Z','X@X.com')
insert into User_Details values(1,'X','Y','Z','X@X.com')
insert into User_Details values(2,'P','Q','R','P@P.com')
insert into User_Details values(3,'M','N','O','M@M.com')
insert into User_Details values(3,'M','N','O','M@M.com')
IF OBJECT_ID('tempdb..#TempTable') IS NOT NULL
DROP TABLE #TempTable
CREATE TABLE #TempTable
(
UserID int ,
FName varchar (50),
MName varchar (50),
LName varchar (50),
Email varchar (50)
)
go
INSERT INTO #TempTable SELECT DISTINCT * FROM User_Details
go
TRUNCATE TABLE User_Details
go
INSERT INTO User_Details SELECT * FROM #TempTable
SELECT * FROM User_Details
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What are different types of statements supported by sql?
What is an exception in pl/sql?
What is the unique index?
What is vector point function?
what are the other commands to know the structure of table using mysql commands except explain command? : Sql dba
What is the difference between pl and sql?
What is user defined functions?
What is pl sql package?
how can we find the number of rows in a table using mysql? : Sql dba
What are stored procedures used for?
What is the use of index in sql?
Why use triggers in sql?
What is a sql schema used for?
Is and as keyword in pl sql?
GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?