在 SQL Server 中替代 COUNTIF

问题描述 投票:0回答:0

我在 SQL Server 上使用

COUNTIF
COUNT
具有条件的特定值,但它出现了错误。

SELECT 
    total rounds, total member, total customer,
    ROUND(total rounds/total member, 2) * 100 AS memberper
FROM 
    (SELECT 
         COUNT(rideid) total rounds
         COUNTIF(member_customer = 'member') AS total member,
         COUNTIF(member_customer = 'customer') AS total customer
     FROM 
         Data)
sql sql-server countif
© www.soinside.com 2019 - 2024. All rights reserved.