Welcome Guest, Not a member yet? Register   Sign In
Fetching subcategories based on a category.
#1

[eluser]Unknown[/eluser]
I have the following `category` table :

category_id parent_id name

1 0 Women

2 1 Saree

3 2 Bridal

4 2 Party Wear

5 2 Casual

I want the output as follows :

Saree
Bridal
Party Wear
Casual

I have written an sql query as follows :

SELECT `name`
FROM `category`
WHERE `parent_id`
IN (

SELECT `category_id`
FROM `category`
WHERE `category_id` =22
)

But this query outputs only Saree.

Please help.

Thanks
Sandip Prasad Ray




Theme © iAndrew 2016 - Forum software by © MyBB