<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.hgotoh.jp/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>努力したWiki - documents:proglang:sql</title>
        <description>推敲の足りないメモ書き多数</description>
        <link>https://wiki.hgotoh.jp/</link>
        <lastBuildDate>Wed, 24 Jun 2026 00:51:04 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://wiki.hgotoh.jp/_media/wiki/logo.png</url>
            <title>努力したWiki</title>
            <link>https://wiki.hgotoh.jp/</link>
        </image>
        <item>
            <title>001.SQLでデータベーステーブルの縦･横変換</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0001</link>
            <description>001.SQLでデータベーステーブルの縦･横変換

2026年06月15日

なんか未だに参照されているし、「説明用の図を追加した方が分かり易くない？」と言われて追加してみた。


2006年07月10日

クエリを思いつかなかった子のために。これはあくまでヒントだぞ。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sun, 14 Jun 2026 21:49:24 +0000</pubDate>
        </item>
        <item>
            <title>002.SQLで各グループ中の最大値を持つレコードに印を付けたい</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0006</link>
            <description>002.SQLで各グループ中の最大値を持つレコードに印を付けたい

2014年8月29日

Oracle 11g Release 11.1 で説明しています。

お客さんへの説明でいろいろやったんでついでに自分の資料用に作ってしまった。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 16 May 2026 11:35:15 +0000</pubDate>
        </item>
        <item>
            <title>003.SQLでTOP3ランキングをやりたい</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0008</link>
            <description>003.SQLでTOP3ランキングをやりたい

2016年8月14日

PostgreSQL 9.5.4 で説明してますが、Oracle でも可能な筈。

夏休み直前に後輩Hシー氏から振られた話題を記録しておく。



下準備

今回のデータは、</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 16 May 2026 11:35:42 +0000</pubDate>
        </item>
        <item>
            <title>004.SQLで時間の集計を行う</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0009</link>
            <description>004.SQLで時間の集計を行う

2017年10月24日

ちょっと調べものしてしまったので自分用メモ。

処理対象データ

PostgreSQLに以下のデータがある。


$ psql -h dbsvr05 kamonohashi kamo
psql (9.5.9, サーバー 9.6.1)
WARNING: psql major version 9.5, server major version 9.6.
         Some psql features might not work.
&quot;help&quot; でヘルプを表示します.

kamonohashi=&gt; \d timelog
       テーブル &quot;public.timelog&quot;
  列  |          型          |  修飾語
------+----------------------+----------
 id   | integer              | not null
 grp  | character varying(3) |
 time | character varying(5) …</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 16 May 2026 11:36:06 +0000</pubDate>
        </item>
        <item>
            <title>005.SQLで不足レコードを補うクエリの発行</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0010</link>
            <description>005.SQLで不足レコードを補うクエリの発行

2017年11月16日

自分用メモ。

処理対象データ

PostgreSQLに以下のデータがある。


$ psql -h 192.168.1.30 kamonohashi kamo
psql (9.6.5)
&quot;help&quot; でヘルプを表示します.

kamonohashi=&gt; select * from salelog;
         day         | item  | qty
---------------------+-------+-----
 2017-10-01 00:00:00 | ITEM1 |  30
 2017-10-02 00:00:00 | ITEM2 |  15
 2017-10-02 00:00:00 | ITEM3 |  20
 2017-10-11 00:00:00 | ITEM1 |  25
 2017-10-13 00:00:00 | ITEM1 |  15
 2017-10-13 00:00:00 | ITEM2 |   5
(6 行)

kamonohashi=&gt;…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 16 May 2026 11:36:28 +0000</pubDate>
        </item>
        <item>
            <title>006.SQLで移動平均を算出</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0011</link>
            <description>006.SQLで移動平均を算出

2020/01/08

平均値格納行がおかしかったので修正。

2020/01/08

職場のTRSHM君に煽られたんでちょっと書く。

概要

	*  直近3日の移動平均を出すサンプルコードを掲示する。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 16 May 2026 11:37:35 +0000</pubDate>
        </item>
        <item>
            <title>007.SQLで指定時間幅でまとめる</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/sql-0014</link>
            <description>007.SQLで指定時間幅でまとめる

2024/03/19 おまけ追加

2024/03/18 ヒントだけ

サンプルデータ

こういうデータがあったとします。



連続した2秒以内の塊を得る

項目DEVID毎に、連続した2秒以内のレコード群を一つのグループに纏めたいという要求がありました。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 16 May 2026 11:37:55 +0000</pubDate>
        </item>
        <item>
            <title>008.SQL関連</title>
            <link>https://wiki.hgotoh.jp/documents/proglang/sql/start</link>
            <description>008.SQL関連</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 30 May 2026 01:34:28 +0000</pubDate>
        </item>
    </channel>
</rss>
