strLevSQL = "SELECT i." & ArrLevel(ArrIndex).strIDParentFieldName & " As IDParent, i." _
& ArrLevel(ArrIndex).strIDItemFieldName & " As IDItem, i." _
& ArrLevel(ArrIndex).strNameItemFieldName & " As NameItem, " _
& "Count(s." & ArrLevel(ArrIndex).strSonIDParentFieldName & ") As CountSubItem " _
& "FROM " & ArrLevel(ArrIndex).strItemTableName & " As i " _
& "LEFT JOIN " & ArrLevel(ArrIndex).strSonTableName & " As s " _
& "ON i." & ArrLevel(ArrIndex).strIDItemFieldName & "=s." & ArrLevel(ArrIndex).strSonIDParentFieldName _
& " GROUP BY i." & ArrLevel(ArrIndex).strIDParentFieldName _
& ", i." & ArrLevel(ArrIndex).strIDItemFieldName _
& ", i." & ArrLevel(ArrIndex).strNameItemFieldName _
& " ORDER BY i." & ArrLevel(ArrIndex).strNameItemFieldName & ";"
|