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 is query execution plan in sql?
What is Histogram?
What is the main difference between sql and pl/sql?
Is left join inner or outer?
Why cannot I use bind variables in ddl/scl statements in dynamic sql?
What is sql prepared statement?
How to create an array in pl/sql?
Explain autonomous transaction.
how to add a new column to an existing table in mysql? : Sql dba
What do you understand by exception handling in pl/sql?
Which normal form is best?
i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this
what is union? : Sql dba
What is field delimiter?
What are all the ddl commands?