Sunday, February 19, 2012

Display of Data category wise

Hi,

I have a requirement where I need to display the items category wise

I have 3 tables,

one stores category_id, parent_id and category_name

second table stored item_id,item_name and proce

3rd table stores category_id and item_id

I need to display the values like this

Category name, Item name

with first parent category ans ites items should be displayed and next sub category and its item

By category table with contain 2 levels of sub category

i.e Category1

Category11

Category111

any help with the query would be much appreciated,

I wrote the query something like this...

select c.category_name,parent_id,item_namefrom category c,items i,Category_item ciwhere

ci.item_id=i.item_idand c.category_id=ci.category_idorderby parent_id, category_name

But it will display all parent category items then the sub category items I want to display like thiscategory1 items1category11 item11category1 item12category11 item111category11 item112 category2 item2

Thanks

What you want is called "grouping".

Seehttp://www.google.com/search?q=gridview+grouping

Jos

|||

Please check the below mentioned URL:

http://vyaskn.tripod.com/hierarchies_in_sql_server_databases.htm

No comments:

Post a Comment