I have code in TSQL for creating a tree, but I am confused: how shall I convert it to mysql ...
CREATE PROCEDURE AccountLedgerViewUnderSundryDebtorCreditorCash  
AS  
WITH GroupInMainGroup (accountGroupId,HierarchyLevel) AS  
(  
select accountGroupId,  
1 as HierarchyLevel  
from tbl_AccountGroup where accountGroupId='27'or accountGroupId = '28'or accountGroupId = '11'  
UNION ALL  
select e.accountGroupId,  
G.HierarchyLevel + 1 AS HierarchyLevel  
from tbl_AccountGroup as e,GroupInMainGroup G  
where e.groupUnder=G.accountGroupId  
)  
SELECT  
ledgerId AS [Account Ledger Id],  
acccountLedgerName AS [Account Ledger Name],  
accountGroupId AS [Account Group Id],  
openingBalance AS [Opening Balance],  
debitOrCredit AS [Credit Or Debit],  
defaultOrNot AS [Editable Or Not],  
description AS [Description]  
FROM tbl_AccountLedger  
where accountGroupId IN (select accountGroupId from GroupInMainGroup)  
 
    