I have this table below:

```
Style   | Color   | Qty
------------------------
Style1  | Red     | 10
Style1  | Black   | 15
Style1  | White   | 7
Style2  | Yellow  | 10
Style2  | Green   | 8
Style3  | White   | 15
Style3  | Black   | 20

```

and I want to get a table, which will have Style and then all its colors separated with comma, but in descending order of their available QUANTITIES (Qty); and SUM of Qty in another column. I have the code which gives me almost what I want, but I don't know how to modify it so as I have colors in correct order. 

```
SELECT DISTINCT A.Style, sum(Qty) as  SumQty,  
  STUFF((SELECT distinct ',' + p.Color  
         FROM inv  as P  
         WHERE A.Style = p.Style  
            FOR XML PATH(''), TYPE  
            ).value('.', 'NVARCHAR(MAX)')  
        ,1,1,'') AS Color  
from inv As A  
group by A.style

```

Result table should look:

```
Style   |     Color          | SumQty
-------------------------------------
Style1  | Black, Red, White  |   32
Style2  | Yellow, Green      |   18
Style3  | Black, White       |   35

```

I would greatly appreciate any help.