Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Delete double entries from a table without primary key
create table tbl (id int, lastprice float, updatetime time, updatems int); insert into tbl VALUES (211709,51370.,'09:30:00',0), (211709,51370.,'09:30:01',0),(211709,51370.,'09:30:01',500), (211709,51370.,'09:30:02',0),(211709,51370.,'09:30:02',0),(211709,51370.,'09:30:03',0),(211709,51370.,'09:30:04',0), (211709,51370.,'09:30:04',300),(211709,51370.,'09:30:04',300); SELECT * from tbl; DELETE seq FROM (SELECT ROW_NUMBER() OVER(PARTITION BY id, updatetime ORDER BY id, updatetime, updatems ASC) AS RowNum FROM tbl ) seq where rownum>1; SELECT * FROM tbl
run
|
edit
|
history
|
help
0
bc160402152
exp 8 XIV
Microsoft SQL Server T-SQL in 10 mn ~ Lesson 13 Subqueries vers. #5
mySQL_Glx_12dec
Employee database
ankit
Primary key and unique key for single column and multi columns
student table create
table emp
Customer_Orders