SELECT a.*,b.G FROM A a,B b WHERE a.ID=b.ID AND a.A=2 AND b.ID=1
select a.*,b.G from A ainner join B b on a.ID=b.Idwhere a.ID=1 and a.A=2