Jess L.
3/28/2007 2:01:00 AM
Thank you v. Much,
that works fine, exactly as required.
however, it requires a temp table to generate the report, which i am not
going to use the SQL Server, instead it will be MS-Access db. the issue when
I try to use ADODB.NET to create an MS Access db, it doesnot work, it
requires adding ADO COM+ "ActiveX Data Objects 2.8 Library" but this
generates errors similar to the following"
'Recordset' is ambiguous in the namespace 'ADODB'
How do I resolve this Issue
Many Thanks in Advance
"M A Srinivas" wrote:
> On Mar 22, 1:39 pm, Jess L. <J...@discussions.microsoft.com> wrote:
> > Hi;
> >
> > I have a database holding accounts tree, where the tables look like this:
> > ==Table #1==
> > RootAccounts = (RootAccount, AccountName, Description,....) [RootAccount=PK]
> > 1001 Fixed Assets bla bla ....
> > 1002 Moveable Assets, bla bla ....
> > ==Table #2==
> > FixedAssets = (FACode, AccountName, Description, FatherCode,..) [FACode=PK,
> > FatherCode = FK]
> > 2001 Buildings bla bla 1001
> > 2002 xxxx bla bla 1001
> > 2003 yyyy bla bla 1002
> > 2004 zzzz bla bla 1001
> >
> > I want to write a SQL Query that generates results as follows:
> >
> > Account Code Account Name Child
> > Accounts
> > ---------------- -----------------
> > ---------------------------------------
> > 1001 Fixed Assets Account Code
> > Account Name
> >
> > ----------------- ------------------
> > 2001
> > Buildings
> > 2002
> > xxxx
> > 2004
> > zzzz
> >
> > 1002 Moveable Assets
> > 2003
> > yyyy
> >
> > Would you please help in generating that?
> >
> > Thanking you
>
> select a.rootaccount,0 as child ,a.accountnamefrom RootAccounts a
> union all
> select a.rootaccount,b.facode as child ,b.accountname from
> RootAccounts a
> inner join fixedassets b
> on a.rootaccount = b.fathercode
> order by a.rootaccount ,child
>
>