want a ado datashape command



I got four table structures as follows



CREATE TABLE [dbo].[Sector] (
	[SectorID] [int] NOT NULL ,
	[SectorName] [varchar] (50)
)

the data is as follows
----------------------
10	Energy





CREATE TABLE [dbo].[GroupMaster] (
	[SectorID] [int] NOT NULL ,
	[GroupID] [int] NOT NULL ,
	[GroupName] [varchar] (50)
)

the data is as follows
-----------------------
10   1010   Energy


CREATE TABLE [dbo].[IndustryMaster] (
	[GroupID] [int] NOT NULL ,
	[IndustryID] [numeric](6, 0) NOT NULL ,
	[IndustryName] [varchar] (50)
)


the data is as follows
-------------------------------------------
1010	101010	Energy Equipment & Services
1010	101020	Oil & Gas



CREATE TABLE [dbo].[SubIndustryMaster] (
	[IndustryID] [numeric](6, 0) NOT NULL ,
	[SubIndustryID] [numeric](8, 0) NOT NULL ,
	[SubIndustryName] [varchar] (30)
)

the data is as follows
-----------------------------------------------------
101010	10101010	Oil & Gas Drilling
101010	10101020	Oil & Gas Equipment & Svcs
101020	10102010	Integrated Oil & Gas
101020	10102020	Oil & Gas Exploration & Prod
101020	10102030	Oil & Gas Refining & Mktg
101020	10102040	Oil & Gas Storage & Transpor
101020	10102050	Coal & Consumable Fuels


Now i want a ADO DataShape command which results the following


Energy
	Energy
		Energy Equipment & Services
			Oil & Gas Drilling
			Oil & Gas Equipment & Svcs

		Oil & Gas
			Integrated Oil & Gas
			Oil & Gas Exploration & Prod
			Oil & Gas Refining & Mktg
			Oil & Gas Storage & Transpor
			Coal & Consumable Fuels

.



Relevant Pages