2:select distinct b from A where a=@var @var为你的输入变量
2.select a,b from a group by a,b having count(b)=1
我觉得select a,b from a group by a,b having count(b)=1 不太合理。给出另外一个。 供参考。 select distinct a1.c1,a1.c2 from a a1 inner join a a2 on a1.c1=a2.c1 and a1.c2<>a2.c2
哎,上面的字段又不正确,下面的试一试: select distinct a1.a,a1.b from a a1 inner join a a2 on a1.a=a2.a and a1.b<>a2.b
1. update B set B.name=A.name where B.id=A.id2. select * from A m join A n on m.a=n.a and m.b<>n.b
1. update B set B.name=A.name where B.id=A.id2. select * from A m join A n on m.a=n.a and m.b<>n.b
1. update B set B.name=A.name from B,A where B.id=A.id 2. select * from (select a,b from A group by b,a) temp where temp.a in (select temp.a from (select jk,b from A group by b,jk) temp group by temp.a having (count(temp.a) >1))
1. update B set B.name=A.name from B,A where B.id=A.id 2. select * from (select a,b from A group by b,a) temp where temp.a in (select temp.a from (select jk,b from A group by b,jk) temp group by temp.a having (count(temp.a) >1))
@var为你的输入变量
不太合理。给出另外一个。
供参考。
select distinct a1.c1,a1.c2 from a a1 inner join a a2 on a1.c1=a2.c1 and a1.c2<>a2.c2
select distinct a1.a,a1.b from a a1 inner join a a2 on a1.a=a2.a and a1.b<>a2.b
from A m
join A n on m.a=n.a and m.b<>n.b
from A m
join A n on m.a=n.a and m.b<>n.b
update B set B.name=A.name from B,A where B.id=A.id
2.
select * from (select a,b from A group by b,a) temp where temp.a in
(select temp.a from (select jk,b from A group by b,jk) temp group by temp.a having (count(temp.a) >1))
update B set B.name=A.name from B,A where B.id=A.id
2.
select * from (select a,b from A group by b,a) temp where temp.a in
(select temp.a from (select jk,b from A group by b,jk) temp group by temp.a having (count(temp.a) >1))