create table test_table
(u_id int,u_name varchar(20))
insert test_table select 1,'a1'
union all select 2,'b2'
union all select 3,'c3';
测试数据 test_table_link
create table test_table_link
(u_id int,u_other varchar(50))
insert test_table_link select 1,'each month'
union all select 1,'each day'
union all select 1,'each year'
union all select 55,'each day'
union all select 55,'each year'
union all select 3,'each day'
union all select 3,'each year'
union all select 88,'each day'
union all select 88,'each month';
结果
select a.u_id,a.u_name,b.u_other
from test_table a LEFT OUTER JOIN test_table_link b
ON a.u_id=b.u_id;