0

我想为我的系统创建一个黑名单。当某人取消3次时,他必须被列入黑名单。所以 areservation有一个booker_id,所以我必须计算所有这些状态为取消的预订者 ID。取消状态在另一列reservation_status中。

有人可以帮我解决这个问题吗?我有这样的东西,但不知道它是否好用

select count(case 
        when reservation_status = 'Canceled' then 1 
        else null end) as booker_id
4

1 回答 1

0
select booker_id, count(reservation_status)
from YourTable
where reservation_status = 'Canceled'
group by booker_id
having count(reservation_status) >= 3
于 2013-12-03T21:37:47.383 回答