Sha256: 9e98843c8e10f85a53e28cca936d218831552190ec8df7a29b7613b3772224b0
Contents?: true
Size: 554 Bytes
Versions: 18
Compression:
Stored size: 554 Bytes
Contents
CREATE OR REPLACE VIEW type_stream_summary AS WITH type_count AS ( SELECT type, stream_name, COUNT(id) AS message_count FROM messages GROUP BY type, stream_name ), total_count AS ( SELECT COUNT(id)::decimal AS total_count FROM messages ) SELECT type, stream_name, message_count, ROUND((message_count / total_count)::decimal * 100, 2) AS percent FROM type_count, total_count ORDER BY type, stream_name;
Version data entries
18 entries across 18 versions & 1 rubygems