title: I want to show category,subcategory,product and price from 2 tables
body: <h2>I have 2tables.one is category which contains id,cat_name,parent_id.This table contains category and subcategory both. parent_id of category is 0 and subcategory's parent id is id of category . another table is product contains id,pnname,price,pro_id.pro_id is id of subcategory.</h2>
  
  <h2>Not giving proper value any of this query</h2>
  
  <pre><code>  id cat_name parent_id      id  pname  pro_id
    --------------------      --------------------
     1 Electronics  0           1  abc     3
     2 Clothing     0           2  def     4
     2 Clothing     0
     3 Phone        1
     4 Kurti        2
  
    output:
    category      subcategory    Product 
    --------------------------------------
     Electronics     Phone       abc  
     Clothing        Kurti       def
    select product.pname from product where product.pro_id=(SELECT c1.cat_name, c2.cat_name FROM category c1, category c2 WHERE c1.id = c2.parent_id)
  
  SELECT product.pname, category.cat_name
  FROM product
  INNER JOIN category ON category.id = product.pro_id
  OR category.parent_id =0
   SELECT product.pname, category.cat_name
   FROM product INNER JOIN category ON product.pro_id=(SELECTc1.cat_name,  c2.cat_name FROM category c1, category c2 WHERE c1.id = c2.parent_id)
  </code></pre>