Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
モノのテーブルがあれば...
ThingName | ThingCategory ------------------------- thing 1 | cat1 thing 2 | cat2 thing 3 | cat3
cat2最初、次にcat1、次にの順序でそれらを選択するにはどうすればよいですか?cat3
cat2
cat1
cat3
これは可能ですか?
あなたはこのようにそれを行うことができます
SELECT ThingName , ThingCategory FROM yourtabe ORDER BY CASE WHEN ThingCategory = 'cat2' THEN 1 WHEN ThingCategory = 'cat1' THEN 2 WHEN ThingCategory = 'cat3' THEN 3 END