select a.id,a.name,b.name from a,b where a.id=b.id
楼上正解,通过左连接就可以查到你想要的结果啦
SELECT B.ID,B.NAME,A.NAME FROM B LEFT JOIN A ON B.ID=A.ID