WP_Query
select *, end_date < now() as flag from posts order by flag , case when flag = 0 then end_date end desc , case when flag = 1 then project_percent end desc;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)