ORACLE/COUNT

データー件数を数える集計ファンクション

テーブルの件数を数える (総数)

select count(*) from table1;

データーの件数を数える (重複していないものだけ、データーの種類を数える)

select count(distinct field1) from table1;

または

select count(*) 
    from ( select distinct field1
           from table1);

ダブっている件数を数える

テーブル table1 の、フィールド field1 のダブっている(重複している)ものと、その件数を抽出する。

select field1, cnt
    from ( select field1, count(*) as cnt 
           from table1
           group by field1)
    where cnt > 1);


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2009-02-11 (水) 11:36:11 (5550d)