mysql order by values and then show the rest -


i want order results of mysql query

1) show first entrys wich match given condition , order them randomly

2) , show rest of results ordered date desc

i tryed this:

select * post inner join user on post.user_id = user.id order user.type = "top" desc, created desc; 

many thanks

use case statement

select * post  inner join user on post.user_id = user.id  order case when user.type = 'top'                1                else 2           end asc,           created desc; 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -