Click here to Skip to main content
15,881,709 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two tables like Account and Grouptxt for each record in Accounts table i need to find the dependencies in Grouptxt Table,below is the sample data of those 2 tables


Account Table Data:-
#AccountName,ShortName,Type,OpBal,ParentGroup,Move4Report,DebitLimit,CreditLimit
'C' Mannto,'C' Mannto,Customer/Supplier,0.0,Debtors Belgaum,True,0.0,0.0
2M Engineers,2M Engineers,Customer/Supplier,260.0,Debtors Belgaum,True,0.0,0.0
A. A. Engineering,A. A. Engineering,Customer/Supplier,114.0,Debtors Belgaum,False,0.0,0.0
A.C. Enterprises,A.C. Enterprises,Customer/Supplier,0.0,Creditors for Materials,True,0.0,0.0


Grouptxt Table Data:-
#GroupName,ShortName,ParentGroup,isSystem,IsTradingGroup
Asset, Asset, ,True,False
APPLICATION OF FUNDS,APPLICATION OF FUNDS,Asset,False,False
Fixed Assets,Fixed Assets,APPLICATION OF FUNDS,False,False
Gross Block,Gross Block,Fixed Assets,False,False

So now my Question is for each record in Account tables i need to get the dependencies fromo grouptxt table.How to do that?

the O/P Should be in this format
Expenditure <-- Materials Consumed <--Raw Material & Components A.C. Enterprises,A.C. Enterprises,Customer/Supplier,0.0,Creditors for Materials,True,0.0,0.0

For the Record A.C.Enterprises the Dependencies are Raw Material & Components --> Materials Consumed --> Expenditure

like this i need to get for entire table,but not getting how to do that for the entire table


I Tried like this

SQL
SELECT #AccountName
      ,a.ShortName
      ,a.Type
      ,a.OpBal
      ,a.ParentGroup
      ,a.Move4Report
      ,a.DebitLimit
      ,a.CreditLimit
      ,a.row_id,
      g.ParentGroup AS GrpTxt_ParentGroup
FROM Grouptxt   g inner join account a
ON a.ParentGroup=g.ShortName
WHERE #AccountName='Increase/Decrease In Finished Goods'

SELECT * FROM Grouptxt where ParentGroup='Raw Material & Components'

SELECT * FROM Grouptxt Where ShortName='Raw Material & Components'

SELECT * FROM Grouptxt Where ShortName='Materials Consumed'

SELECT * FROM Grouptxt Where ShortName='Expenditure'



Thanks in Advance
Posted
Updated 15-Jul-13 23:52pm
v4
Comments
Maciej Los 16-Jul-13 3:08am    
Please, update your question (using "Improve question" widget) and share with example data for both tables.
Chakri Reddy 16-Jul-13 5:28am    
Hi Maciej Los,Thanks for u r reply
i have modified the Question and i had provided Sample data
Raja Sekhar S 16-Jul-13 3:58am    
Provide some Sample Data... use Improve Question Widget... Be Specific...
Chakri Reddy 16-Jul-13 5:27am    
Hi Raja Sekhar,Thanks for u r reply
I Have Modified the Question and provided sample data.
My Question is
For each row in the Account table expecting the hierarchal flow as shown in the example.
Raja Sekhar S 16-Jul-13 6:36am    
What is the Relation Between two tables..?

1 solution

 
Share this answer
 
Comments
Chakri Reddy 17-Jul-13 1:10am    
HI Maciej Los thanks for your time and replying to my post
Maciej Los 17-Jul-13 3:41am    
You're welcome ;)
Maciej Los 17-Jul-13 3:42am    
By The Way: 3 stars means down-voting ;(
Espen Harlinn 17-Jul-13 8:40am    
Nice set of links :-D
Maciej Los 17-Jul-13 8:54am    
Thank you, Espen ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900