I have two table (category, product) as below:
Category Table:
cid name parent
1  items Null
2    A    1
3    aa   2
4    ab   2
5    ac   2
6    B    1
7    ba   5
8    bb   5
9    bc   5
10   C    1
11   ca   9
12   cb   9
13   cc   9
Product Table:
pid  cid  pname
1     2   p1
2     3   p2
3     4   p3
4     4   p4
5     5   p5
6     5   p6
Here  I want to get all parent and child products for a particular parent. Here I have cid = 2, then I need all the products to cid=2 and its child. 
Here I tried it something like this, but not sure how to join product table with this query: 
select  cid,
        name,
        parent
from    (select * from categories
         order by parent, cid) categories,
        (select @pv := '2') initialisation
where   find_in_set(parent, @pv) > 0
and     @pv := concat(@pv, ',', cid)
UPDATES: DB Model
Can anybody help me out? Thank you.

 
     
     
     
    