2,507
社区成员




create table test1 (id integer,sex integer,Name varchar(10));
insert into test1 values(1, 1, 'a');
insert into test1 values(2, 2, 'b');
insert into test1 values(3, 1, 'c');
insert into test1 values(4, 2, 'd');
create table test2(id integer, Aid integer,score integer);
insert into test2 values(1,1,123);
insert into test2 values(2,3,234);
insert into test2 values(3,2,345);
insert into test2 values(4,4,456);
select c.name as sex1Name,c.score as score1, d.name as sex2Name,d.score as score2 from
(select a.id, a.name,b.score
from test1 a,test2 b where a.id=b.id and a.id%2=1) c,
(select a.id, a.name,b.score
from test1 a,test2 b where a.id=b.id and a.id%2=0) d
where c.id=d.id-1;