有表Test结构如下
ID                   name
1                      aa
2                      bb
3                      cc
4                      dd
5                      aa
6                      ac
7                      cc
8                      df
第一个语句删除重复的数据。但想在重复的数据中只保留一条记录
SQL语句为
delete from test where id not in( select min([id ]) from test group by [name])
第二个语句要求随机获得5条数据,SQL语句为
select top 5 * from test order by newid()

相关文章:

  • 2022-12-23
  • 2021-05-27
  • 2021-08-24
  • 2021-09-18
猜你喜欢
  • 2022-02-02
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-11-08
  • 2022-12-23
相关资源
相似解决方案