34,838
社区成员




create table t1(usercode varchar(10))
insert into t1 values('u01')
insert into t1 values('u02')
insert into t1 values('u03')
insert into t1 values('u04')
create table t2(usercode varchar(10),userflag varchar(10))
insert into t2 values('u01', 'aa')
insert into t2 values('u01', 'bb')
insert into t2 values('u01', 'cc')
insert into t2 values('u01', 'dd')
go
insert into t2 select t1.usercode, t2.userflag from t1 , t2
where t1.usercode <> 'u01' and t2.usercode = 'u01'
select * from t2 order by usercode ,userflag
drop table t1 , t2
/*
usercode userflag
---------- ----------
u01 aa
u01 bb
u01 cc
u01 dd
u02 aa
u02 bb
u02 cc
u02 dd
u03 aa
u03 bb
u03 cc
u03 dd
u04 aa
u04 bb
u04 cc
u04 dd
(所影响的行数为 16 行)
*/