select a.course,a.sem, b.* from tb_course a, tb_pcode b where a.id=b.course and a.sem=1 and (a.type='pgs')