SELECT `a`.*, `b`.`balance`
FROM (`_ref_acct_group` a)
JOIN `comp_acct_type` b ON `b`.`ID` = `a`.`acctTypeID`
WHERE `a`.`parentID` != 0
AND (a.acctTypeID = 1 OR a.acctTypeID = 2 OR a.acctTypeID = 5)
ORDER BY `a`.`parentID`, `a`.`orderNo`