// {from: 1, to: 2, label: 'middle', font: {align: 'middle'}},
// SQL Query > Select Data
varsql="select from_ci_id as from, to_ci_id as to from cmdb.relation;";
varsql="select from_ci_id as from, to_ci_id as to, rt.display_name as label, '__FONT__' as font from cmdb.relation r inner join cmdb.relation_type rt on r.relation_type_id=rt.id;";
varsql="select c.id, c.display_name as label, (select class_type_id from cmdb.class c2 where c2.id=c.group_type_id) as type_id from cmdb.ci_family_group c inner join cmdb.relation r on r.from_ci_id = c.id where r.relation_type_id=0 and r.to_ci_id = $1 ";
varsql="select c.id, concat('grupp: ', c.display_name) as label, (select class_type_id from cmdb.class c2 where c2.id=c.group_type_id) as type_id from cmdb.ci_family_group c inner join cmdb.relation r on r.from_ci_id = c.id where r.relation_type_id=0 and r.to_ci_id = $1 ";
sql+="UNION ";
sql+="select c.id, c.display_name as label, (select class_type_id from cmdb.class c2 where c2.id=c.group_type_id) as type_id from cmdb.ci_family_group c inner join cmdb.relation r on r.to_ci_id = c.id where r.relation_type_id=0 and r.from_ci_id = $1 ";
sql+="select c.id, concat('grupp: ', c.display_name) as label, (select class_type_id from cmdb.class c2 where c2.id=c.group_type_id) as type_id from cmdb.ci_family_group c inner join cmdb.relation r on r.to_ci_id = c.id where r.relation_type_id=0 and r.from_ci_id = $1 ";
sql+="UNION ";
sql+="select c.id, c.display_name as label, (select class_type_id from cmdb.class c2 where c2.id=c.group_type_id) as type_id from cmdb.ci_family_group c where c.id = $1 ";
sql+="select c.id, concat('grupp: ', c.display_name) as label, (select class_type_id from cmdb.class c2 where c2.id=c.group_type_id) as type_id from cmdb.ci_family_group c where c.id = $1 ";
sql+="UNION ";
sql+="select c.id, c.display_name as label, (select class_type_id from cmdb.class c2 where c2.id=c.account_type_id) as type_id from cmdb.ci_family_account c inner join cmdb.relation r on r.from_ci_id = c.id where r.relation_type_id=0 and r.to_ci_id = $1 ";
sql+="select c.id, concat('användare: ', c.display_name) as label, (select class_type_id from cmdb.class c2 where c2.id=c.account_type_id) as type_id from cmdb.ci_family_account c inner join cmdb.relation r on r.from_ci_id = c.id where r.relation_type_id=0 and r.to_ci_id = $1 ";
sql+="UNION ";
sql+="select c.id, c.display_name as label, (select class_type_id from cmdb.class c2 where c2.id=c.account_type_id) from cmdb.ci_family_account c inner join cmdb.relation r on r.to_ci_id = c.id where r.relation_type_id=0 and r.from_ci_id = $1 ";
sql+="select c.id, concat('användare: ', c.display_name) as label, (select class_type_id from cmdb.class c2 where c2.id=c.account_type_id) from cmdb.ci_family_account c inner join cmdb.relation r on r.to_ci_id = c.id where r.relation_type_id=0 and r.from_ci_id = $1 ";
sql+="UNION ";
sql+="select c.id, c.display_name as label, (select class_type_id from cmdb.class c2 where c2.id=c.account_type_id) from cmdb.ci_family_account c where c.id = $1 ";
sql+="select c.id, concat('användare: ', c.display_name) as label, (select class_type_id from cmdb.class c2 where c2.id=c.account_type_id) from cmdb.ci_family_account c where c.id = $1 ";
varsql="select from_ci_id as from, to_ci_id as to from cmdb.relation where from_ci_id = $1 or to_ci_id = $1;";
varsql="select from_ci_id as from, to_ci_id as to, rt.display_name as label, '__FONT__' as font from cmdb.relation r inner join cmdb.relation_type rt on r.relation_type_id=rt.id ";