几个极简的SQL连接 没毛病

create table temp111(

id int,
idname varchar(12)

);

create table temp222(

id int,
idname varchar(12)

);

insert into temp222 values(1,'2000');

select t1.*,t2.idname
from temp111 t1
left join
temp222 t2
on t1.id = t2.id;

/**
 ID IDNAME IDNAME
 -- ------ ------
  1 1110   222
  1 1110   2000
  **/
select t1.*,t2.idname
from temp111 t1
inner join
temp222 t2
on t1.id = t2.id; 

/**
 ID IDNAME IDNAME
 -- ------ ------
  1 1110   222
  1 1110   2000

  ***/
  --NP
  select * from 
  table1
  left join 
  table2 on ,
  table3,
  table4
  where table3=  and table4 = 

原文地址:https://www.cnblogs.com/TendToBigData/p/10501242.html