Skip to content

Instantly share code, notes, and snippets.

@bingogg14
Created September 9, 2021 08:10
Show Gist options
  • Save bingogg14/9b3abd17153870de06afb76946d30544 to your computer and use it in GitHub Desktop.
Save bingogg14/9b3abd17153870de06afb76946d30544 to your computer and use it in GitHub Desktop.
select *, (IF(ISNULL(profile_note.metric_id), 'General', metrics.metric)) as sortable
from `profile_note`
left join `metrics_index` as `metrics` on `profile_note`.`metric_id` = `metrics`.`id`
where (`created_by` in (select `id` from `users` where `account_id` = 27))
and `profile_id` = 75
order by sortable asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment