How to display output in % using this case condition in clickhouse database
P粉237125700
P粉237125700 2023-09-15 00:07:20
0
1
697

How to use this case condition in clickhouse database to display output in % form.

ROUND(count(distinct case when bt.status = 'approved' then bt.id else null end)/count(distinct p.id) * 100) as "SR- txns"

P粉237125700
P粉237125700

reply all(1)
P粉754473468

But it works as is? ? ?

create table test(id int, id2 int, status String) Engine=Memory
as select number,number, ['approved', 'completed'][number%3] from numbers(10);

select ROUND(count(distinct case when status = 'approved' then id else null end)/count(distinct id2) * 100) as "SR- txns"
from test
┌─SR- txns─┐
│       30 │
└──────────┘

Clickhouse style syntax:

select ROUND(uniqExactIf(id,status = 'approved')/uniqExact(id2) * 100) as "SR- txns"
from test
┌─SR- txns─┐
│       30 │
└──────────┘
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!