Home » SQL & PL/SQL » SQL & PL/SQL » tree view query
tree view query [message #210259] Wed, 20 December 2006 01:19 Go to next message
annu-agi
Messages: 238
Registered: July 2005
Location: Karachi
Senior Member

i m having a problem with tree view. actually i made a input module .. perfectly .. but now i m stuck in query and i dont have an idea how to make query to retrive data like in tree view and make report with it .. please help me out of this
DATA STORE IN TABLE LIKE THIS



COM_CD ITEM_CD ITEM_NM ITEM_UNIT ITEM_TYPE STORE_CD ITEM_PARENT_ID ITEM_LVL
01 001 RAW MATERIAL C 01 1
01 001001 SMP HULLA KGS I 01 001 2
01 002 PACKING MATERIAL C 01 1
01 003 MACHINERY PARTS C 02 1
01 004 ICE-CREAMS C 03 1
01 004001 TEN LITRES C 03 004 2
01 004001001 VANILLA 10 LTRS I 03 004001 3
01 004001002 STRAWBARRY 10 LTRS I 03 004001 3
01 004001003 PISTACHIO 10 LTRS I 03 004001 3
01 004002 TWO LITRES C 03 004 2
01 004003 SUPREME 1000 ML C 03 004 2
01 004004 ONE LITRES C 03 004 2
01 004005 HALF LITRES C 03 004 2
01 004006 IGLOO'S CONE C 03 004 2
01 004007 CUPS 125 ML C 03 004 2
01 004008 FUNDAE CUPS C 03 004 2
01 004009 MINI CUPS C 03 004 2
01 004010 STIKCS RANGES C 03 004 2
01 004011 CAKES C 03 004 2



Item Type is show I for ITEM and C for CATAGORY ..
I want group above report which shown step by step CAtegory then Item ...
Please help me out
  • Attachment: abc.txt
    (Size: 0.83KB, Downloaded 479 times)
Re: tree view query [message #210301 is a reply to message #210259] Wed, 20 December 2006 03:53 Go to previous message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member

use Connect by prior to get a tree walking

SQL> select * from your_table
connect by prior item_cd = item_parent_id
start with item_parent_id is null;
Previous Topic: Removal of more than two duplicates..
Next Topic: Script error help
Goto Forum:
  


Current Time: Sat Dec 14 15:48:13 CST 2024