如何检索出在某个字段上相同的记录?

newline 2003-12-24 02:19:38
要检索出table1上col1字段上相同的记录,SQL如何写?
...全文
25 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qqba 2003-12-24
  • 打赏
  • 举报
回复
select * from table1 a where a.id!=(select max(id) from table b where a.coll=b.coll)
qiaolin53 2003-12-24
  • 打赏
  • 举报
回复
select column,coount(*) from table1
group by column
having count(*)>1
newline 2003-12-24
  • 打赏
  • 举报
回复
谢谢!
victorycyz 2003-12-24
  • 打赏
  • 举报
回复
select a.*
from table1 a join
( select col1
from table1
group by col1
having count(*)>1
) b
on a.col1=b.col1

34,589

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧