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
Student
SQL2
QLCB_BTVN_TUAN 8
Conditional Operator (IIF)
new
QLDT_TUAN 7
Las reglas Codd para una base de datos relacional Bry
sql to search database objects' definitions for text
sadasd
Movies