Select * from tbl_main,tbl_sub where tbl_main.main_id=tbl_sub.main_id and tbl_sub.sub_id='29'