create table testA(
Id number(10) primary key,
Name varchar(10)
);
insert into testA values(1, '小黄');
insert into testA values(2, '小绿');
insert into testA values(3, '小白');
insert into testA values(4, '小黑');
insert into testA values(5, '小花');
commit;
create table testB(
Id number(10) primary key,
age number(10)
);
insert into testB values(1, 10);
insert into testB values(2, 11);
insert into testB values(3, 12);
insert into testB values(4, 13);
commit;
1、join on后面加and
select *
from testA a
left join testB b on a.id = b.id
and b.age = 10
2、where后面加on
select *
from testA a
left join testB b on a.id = b.id
where 1=1
and b.age = 10