Рабочий SQL запрос который выдает результат.
SELECT "tds"."DEPARTMENTS", ("tes"."FAM" || ' ' || "tes"."NAME" || ' ' || "tes"."OTCH") AS FIO,
REPLACE(SUBSTRING ("tes"."PHONE",1, 6),'-','') AS "Phone"
FROM "EMPLOYEES" "tes"
INNER join "DEPARTMENTS" "tds" ON "tes"."DEPT_ID" = "tds"."DEPT_ID"
ORDER By "tes"."FIRSTONLIST" ASC, "tes"."DEPT_ID"
Необходимо чтобы результат выгружался в XML файл в таком формате.
<?xml version="1.0" encoding="UTF-8"?>
<YealinkIPPhoneBook>
<Title>Yealink</Title>
<Menu Name="Отдел1">
<Unit Name="Пользователь1" Phone1="1234" Phone2="" Phone3="" default_photo="Resource:"/>
<Unit Name="Пользователь2" Phone1="1235" Phone2="" Phone3="" default_photo="Resource:"/>
</Menu>
<Menu Name="Отдел4">
<Unit Name="Пользователь4" Phone1="1237" Phone2="" Phone3="" default_photo="Resource:"/>
<Unit Name="Пользователь5" Phone1="1238" Phone2="" Phone3="" default_photo="Resource:"/>
<Unit Name="Пользователь6" Phone1="1239" Phone2="" Phone3="" default_photo="Resource:"/>
</Menu>
<Menu Name="Отдел9">
<Unit Name="Пользователь9" Phone1="1242" Phone2="" Phone3="" default_photo="Resource:"/>
<Unit Name="Пользователь10" Phone1="1243" Phone2="" Phone3="" default_photo="Resource:"/>
<Unit Name="Пользователь11" Phone1="1244" Phone2="" Phone3="" default_photo="Resource:"/>
</Menu>
</YealinkIPPhoneBook>