我在 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)