Xml

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • captainkirk
    New Member
    • Jan 2007
    • 1

    #1

    Xml

    Hello everybody

    I have a table like this
    1,red
    1,black
    1,red
    2,red
    2,yellow
    2,green
    2,red

    with this Query
    select num ,
    xmlserialize(co ntent xmlagg(
    xmlelement(name "color", color))
    as varchar(1024))
    from table
    group by num


    I obtain
    1 red, black, red
    2 red, yellow, green, red

    How can I obtain a unique list of colors, like this (of course without any stored procedure)
    1 red, black
    2 red, yellow, green,

    thanks
Working...