varsql="select * , (select count(*) from cmdb.ci c where c.parent_id = id) as childs from cmdb.ci where family_type_id = 1 and id > 0 order by family_type_id, family_id, display_name";
varsql="select * , (select count(*) as childs from cmdb.ci child where child.parent_id = parent.id) as childs from cmdb.ci parent where parent.parent_id = $1 order by family_type_id, family_id, display_name";
// var sql = "select id, concat(id, '. ', (select display_name from cmdb.organisation_type as ot where// ot.id=organisation_type), ': ', display_name) as label from cmdb.organisation where id >0;";