SELECT `a`.*, `b`.`name`, `b`.`id` as `user_id`
FROM `job__discussion` `a`
LEFT JOIN `user` `b` ON `b`.`id` = `a`.`created_by`
WHERE `a`.`job_id` = '580'
AND `a`.`is_delete` = 0
ORDER BY `a`.`is_pinned` DESC, `a`.`created_ts` DESC