<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>koogucc11</author_name>
  <author_url>https://blog.hatena.ne.jp/koogucc11/</author_url>
  <blog_title>都内で働くSEの技術的なひとりごと / Technical soliloquy of System Engineer working in Tokyo</blog_title>
  <blog_url>https://ryuchan.hatenablog.com/</blog_url>
  <categories>
    <anon>SQL Server</anon>
  </categories>
  <description>今年は 10 年以上ぶりにお盆に帰郷します。しかも、車で。ということで車の総点検中です。 今回は SUM 関数の使い方を少し工夫してみたいと思います。Sales.SalesOrderHeader テーブルを使って、TerritoryID 別の数を算出します。下記のクエリを SQL Server Management Studio で実行してみましょう。 SELECT [TerritoryID_is_1] = SUM(CASE WHEN TerritoryID = 1 THEN 1 ELSE 0 END), [TerritoryID_is_2] = SUM(CASE WHEN Territory…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fryuchan.hatenablog.com%2Fentry%2F2016%2F07%2F30%2F162421&quot; title=&quot;便利な SQL の関数とか、構文とか、その他色々まとめてみる - その12 ( SUM の使い方の工夫 ) -  - 都内で働くSEの技術的なひとりごと / Technical soliloquy of System Engineer working in Tokyo&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>https://cdn-ak.f.st-hatena.com/images/fotolife/k/koogucc11/20160730/20160730161500.jpg</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2016-07-30 16:24:21</published>
  <title>便利な SQL の関数とか、構文とか、その他色々まとめてみる - その12 ( SUM の使い方の工夫 ) - </title>
  <type>rich</type>
  <url>https://ryuchan.hatenablog.com/entry/2016/07/30/162421</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
