select p.*,ct.cname from product as p left join category as ct on p.catid = ct.pid where catid = '31'