oraclesql根据id去重
时间: 2023-08-19 07:08:03 浏览: 154
根据提供的引用内容,可以使用以下Oracle SQL语句根据ID进行去重:
```sql
select * from test t where t.ROWID in (select min(t2.ROWID) from test t2 group by t2.id);
```
这个查询语句会返回表test中根据ID去重后的结果。它使用了子查询来找到每个ID的最小ROWID,并将其与原表进行匹配,从而得到去重后的结果。
#### 引用[.reference_title]
- *1* *3* [Oracle 数据去重sql](https://blog.csdn.net/czc_292/article/details/122811160)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Oracle 根据主键去重(最高效)](https://blog.csdn.net/weixin_54108529/article/details/124455412)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文