游客发表

使用SQL子查询实现查找唯一值

发帖时间:2025-11-05 05:00:45

使用SQL子查询实现查找唯一值
复制if object_id(Test_Users) is not null   drop table Test_Users   go   create table Test_Users(AutoID int identity(1,使用1) primary key,UserGroupID int,UserName varchar(50))   go   set xact_abort on   begin tran   insert into Test_Users(UserGroupID,UserName)   select 2,aa union   select 2,bb union   select 3,cc union   select 1,Admin union   select 3,ff union   select 2,pp    commit tran   go   select * from Test_Users a   where UserGroupID not in   (select UserGroupID from Test_Users where AutoID<>a.AutoID)   1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.

    热门排行

    友情链接