Suppose there are two tables. First table, 'user_actions', has two fields: 'user_id' and 'action'. Second table, 'users', also has two fields: 'id' and 'name'. I want to sort the first table so that actions commited by users Aaron or Bruce go first and actions commited by Yuriy and Zorro go last. How would I do that?
J'ai essayé ceci :
select * from `user_actions` order by field(`user_id`,(select distinct `id` from `users` order by `name`))
Ne fonctionne pas.