SELECT
t1.a_id,
t1. NAME,
t2.b_id,
t2.create_time
FROM
a AS t1
LEFT OUTER JOIN b AS t2 ON t1.a_id = t2.a_id
WHERE
t2.b_id = (
SELECT
b.b_id
FROM
b
WHERE
a_id = t1.a_id
ORDER BY
create_time ASC
LIMIT 1
)
select tb1.a_id,tb2.b_id,name from tb1
left join (select a_id,min(createtime) as min_time from tb2 group by a_id) t on t.a_id = tb1.a_id
left join tb2 on tb2.a_id = tb1.a_id and tb2.createtime = t.min_time
create table a (a_id int,name varchar(15));
create table b (b_id int ,a_id int,create_time datetime);
insert into a set a_id=1,name='1';
insert into a set a_id=2,name='2';
insert into b set b_id=1,a_id=1,create_time=now();
insert into b set b_id=2,a_id=1,create_time=now();
insert into b set b_id=3,a_id=1,create_time=now();
insert into b set b_id=4,a_id=2,create_time=now();
insert into b set b_id=5,a_id=2,create_time=now();
select a.a_id,name,b_id,create_time from a,(select * from b group by a_id order by create_time asc ) c where a.a_id=c.a_id ;
+------+------+------+---------------------+
| a_id | name | b_id | create_time |
+------+------+------+---------------------+
| 1 | 1 | 1 | 2016-11-24 18:34:56 |
| 2 | 2 | 4 | 2016-11-24 18:35:53 |
+------+------+------+---------------------+
以下



SQLok, 直接上图附执行SQL
你看这样可行吗?