create table customer(id int,name varchar(20),email varchar(20)) create table dianying(id int,name varchar(20)) create table zhongjian(id int ,cid int ,did int) insert into customer values(3,'ccccc','[email protected]') insert into dianying values(2,'积极') insert into zhongjian values(2,1,3) select * from customer select * from dianying select * from zhongjian select c.name,c.email,d.name from customer as c,dianying as d where c.id=2 and d.id=(select did from zhongjian where cid=2)
create table dianying(id int,name varchar(20))
create table zhongjian(id int ,cid int ,did int)
insert into customer values(3,'ccccc','[email protected]')
insert into dianying values(2,'积极')
insert into zhongjian values(2,1,3)
select * from customer
select * from dianying
select * from zhongjian
select c.name,c.email,d.name from customer as c,dianying as d where c.id=2 and d.id=(select did from zhongjian where cid=2)