select
custNo.HUEid
,(
select [Appel],[Orange],[Mango] from
(select * from hue h where HUEid = custNo.HUEid) p
Pivot(
max(pid) for HUENome in ( [Appel],[Orange],[Mango])
) as seq
For xml auto ,type
)
from hue custNo
group by hueid
For xml auto ,root ('Sample')
This is my T-Sql version using Pivot and For Xml, hope this help =)