(1) Table Name Groups
| ID | parent_id| Name |
| 1 | NULL| Assets |
| 2 | NULL| Liabilities and Owners Equity |
| 3 | NULL| Incomes |
| 4 | NULL| Expenses |
| 5 | 1 | Fixed Assets |
| 6 | 1 | Current Assets |
| 7 | 1 | Current Assets |
| 8 | 2 | Capital Account |
| 9 | 2 | Current Liabilities |
| 10| 2 | Loans (Liabilities) |
| 11| 3 | Direct Incomes |
| 12| 4 | Direct Expenses |
| 13| 3 | Indirect Incomes |
| 14| 4 | Indirect Expenses |
| 15| 3 | Sales |
| 16| 4 | Purchases |
| 17| 6 | Cash at Bank |
| 18| 17 | KWL Banks |
(2) Table Name ledger
| ID| GroupID | Name |
| 1| 18 | 1708-6 ABL |
I need query result like below
--------------------------------------------------
Assets
Current Assets
Cash at Bank
KWL Banks
1708-6 ABL
Fixed Assets
Investments
--------------------------------------------------
Liabilities and Owners Equity
Capital Account
Current Liabilities
Loans (Liabilities)
--------------------------------------------------
Incomes
Direct Incomes
Indirect Incomes
Sales
--------------------------------------------------
Expenses
Direct Expenses
Indirect Expenses
Purchases
Asked
Active
Viewed 30 times
0
Drew
- 24,556
- 10
- 41
- 75
Imran Khan
- 1
- 1
-
Have you tried anything yet? – Tim Biegeleisen Oct 24 '16 at 06:13
-
Your output is how you wanna show on frontend not a sql output. Please provide how you want your output in result set. – Esty Oct 24 '16 at 06:18
-
Those left joins only work as well as some assumed depth. If you need a stored proc to work against any depth I have a few floating around. Just ping me – Drew Oct 24 '16 at 06:22
-
what are you talking about? Drew....... – Imran Khan Oct 24 '16 at 06:34