Success rate by payment method (ClickHouse)

Success rate by payment method (ClickHouse)

In payments, for each method compute the total number of transactions total = count(), the number of successful ones successes = rows with status = 'success', and success_rate = successes / total rounded to 4 decimals. The denominator count() is always > 0 inside a group. Use countIf. Order by method. Columns: method, total, successes, success_rate.

Row order matters

PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid