Reputation: 163
A categories table which contains id
, category_name
,category_type
etc.
I am getting all the records with SELECT
query.
suppose I have a category name
Shared article
and I want to get it first position in my records.
of course I am using simple query
SELECT `category_name`,`category_type`,`categories`.`id`,
count(`user_bookmarks`.`id`) as counter FROM `categories`
LEFT JOIN `user_bookmarks`
ON `categories`.`id`=`user_bookmarks`.`category_id`
WHERE `categories`.`user_id`=39 GROUP By `categories`.`category_name`
but I don't know how achieve my task?
Is it possible with MySQL
?
Upvotes: 0
Views: 71
Reputation: 44844
Yes you can do as
order by
`categories`.`category_name` = 'Shared article' desc
Upvotes: 1