Friday, January 8, 2016

Sort 2 columns at once SQL table using sub-query

SELECT t1.*
FROM PlanActual AS t1
INNER JOIN (
SELECT MIN(Seq) AS minSeq, Phase
FROM PlanActual
GROUP BY Phase
) AS t2 ON t1.Phase = t2.Phase
ORDER BY t2.minSeq

Group by Phase
Order by Sequence

No comments:

Post a Comment