Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
about fetching datas from two tables
11-13-2014, 06:29 PM,
Post: #1
about fetching datas from two tables
please help i have two table 1st name "main category" and another one is "sub category" in main category i have parent_id,parent_name,parent_desc and in sub category i have sid,parent_id, sname, sdesc the parent_id is main category data but i want to display the main category parent_name as heading and sub category related to parent_name will display under the parent_name pls helpme
11-28-2014, 05:47 AM,
Post: #2
RE: about fetching datas from two tables
SELECT sub_category.sid, sub_category.sname, sub_category.sdesc, main_category.parent_name FROM sub_category LEFT JOIN main_category ON sub_category.parent_id=main_category.parent_id

Forum Jump:

Users browsing this thread: 1 Guest(s)