Sha256: e590e328434822509c463352d25fb67d131671758c4f75729ec1a923ce2f5130

Contents?: true

Size: 625 Bytes

Versions: 16

Compression:

Stored size: 625 Bytes

Contents

CREATE OR REPLACE VIEW message_store.category_type_summary AS
  WITH
    type_count AS (
      SELECT
        message_store.category(stream_name) AS category,
        type,
        COUNT(id) AS message_count
      FROM
        message_store.messages
      GROUP BY
        category,
        type
    ),

    total_count AS (
      SELECT
        COUNT(id)::decimal AS total_count
      FROM
        message_store.messages
    )

  SELECT
    category,
    type,
    message_count,
    ROUND((message_count / total_count)::decimal * 100, 2) AS percent
  FROM
    type_count,
    total_count
  ORDER BY
    category,
    type;

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
message-db-3.0.0 database/views/category-type-summary.sql
message-db-2.1.6 database/views/category-type-summary.sql
message-db-2.1.5 database/views/category-type-summary.sql
message-db-2.1.4 database/views/category-type-summary.sql
message-db-2.1.3 database/views/category-type-summary.sql
message-db-2.1.2 database/views/category-type-summary.sql
message-db-2.1.1 database/views/category-type-summary.sql
message-db-2.1.0 database/views/category-type-summary.sql
message-db-2.0.2 database/views/category-type-summary.sql
message-db-2.0.1 database/views/category-type-summary.sql
message-db-2.0.0 database/views/category-type-summary.sql
message-db-1.1.3 database/views/category-type-summary.sql
message-db-1.1.2 database/views/category-type-summary.sql
message-db-1.1.1 database/views/category-type-summary.sql
message-db-1.1.0 database/views/category-type-summary.sql
message-db-1.0.0 database/views/category-type-summary.sql