由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 这个 Oracle SQL 语句该这么写啊?
相关主题
请教一下这个report的query应该怎么样写?Help! A cluster method in SQL
Oracle Group and Index question怎么求和
适用于sql server 和oracle 的 sql batch?这“精妙sql语句”是错误的吗
How to write this query in Oracle?SQL Server Trigger on System Base Table or Catalog View
Help on Oracle Query一个single table 的 SQL QUERY
ask for help with a simple query!!!SQL find distinct values in large table
Help on Sql server huge table performanceoracle和XML
Rookie's question againsql question
相关话题的讨论汇总
话题: dupes话题: rows话题: game话题: name话题: columns
进入Database版参与讨论
1 (共1页)
g*****r
发帖数: 130
1
How do I compare two rows to see if they are exactly the same? This means if
all fields are the same for the two rows, the two rows are considered dupes
. How could I remove the dupes quickly?
For example, I have a table called "game_play", and it contains columns
player_id, game_name. I can remove dupes like this:
delete from game_played a
where a.rowid > ( select b.rowid from game_played b
where a.player_id = a.player_id
and a.game_name = b.game_name)
It works, but what if I have 100 columns in the table, do I list all column
names out in the above query? That sounds silly. Any good method out there
that I can write the query quick??
Thank you very much!!
T****U
发帖数: 3344
2
try this, which is a little less silly
delete from test1 where rowid not in (select min(rowid) from test1 group by
key1, key2, key3,...);

if
dupes
column

【在 g*****r 的大作中提到】
: How do I compare two rows to see if they are exactly the same? This means if
: all fields are the same for the two rows, the two rows are considered dupes
: . How could I remove the dupes quickly?
: For example, I have a table called "game_play", and it contains columns
: player_id, game_name. I can remove dupes like this:
: delete from game_played a
: where a.rowid > ( select b.rowid from game_played b
: where a.player_id = a.player_id
: and a.game_name = b.game_name)
: It works, but what if I have 100 columns in the table, do I list all column

1 (共1页)
进入Database版参与讨论
相关主题
sql questionHelp on Oracle Query
扳机问题求助ask for help with a simple query!!!
Rapid SQL V.S. TOADHelp on Sql server huge table performance
咋查Oracle job的status呀?Rookie's question again
请教一下这个report的query应该怎么样写?Help! A cluster method in SQL
Oracle Group and Index question怎么求和
适用于sql server 和oracle 的 sql batch?这“精妙sql语句”是错误的吗
How to write this query in Oracle?SQL Server Trigger on System Base Table or Catalog View
相关话题的讨论汇总
话题: dupes话题: rows话题: game话题: name话题: columns