sort array columns



Hello All,

Please suggest how I may sort columns of a matrix by some column values.
For example I have:

<- p: matrix([3,2,5],[7,8,9]);
<- P: sort(p, ???);

I want to have
<- grind(p);
-> matrix([2,3,5],[8,7,9])$

or using list

<- p: [[3,2,5],[7,8,9]];
<- P: sort(p, ???);

I want to have
<- grind(p);
-> [[2,3,5],[8,7,9]]$


Thank you,

Mikhail