<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>aike</author_name>
  <author_url>https://blog.hatena.ne.jp/aike/</author_url>
  <blog_title>aike’s blog</blog_title>
  <blog_url>https://aike.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>SQLで検索結果をソートするときってorder by使うよね。でもさ、単純に大きい順とか五十音順とかじゃなくて、ひと工夫したいときってあるじゃないですか。たとえば、国名のリストをアルファベット順でソートして一覧表示するけど、利便性を考えて日本は一番上に表示したい、とかね。 で、まあ、そういうときは表示順のソートキーを別項目として持ったりするのがいいんだろうなって思ってたんだけど、最近シンプルな解決策を教わりました。 select country_name from t_country order by case country_name when 'Japan' then 1 else 2 e…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Faike.hatenablog.com%2Fentry%2F20100115&quot; title=&quot;SQLのORDER BYにCASE式が使えてちょっと嬉しかったお話 - aike’s blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-01-15 00:00:00</published>
  <title>SQLのORDER BYにCASE式が使えてちょっと嬉しかったお話</title>
  <type>rich</type>
  <url>https://aike.hatenablog.com/entry/20100115</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
