我正在尝试创建一个带有查询查询的图表,但无论我尝试什么,都会收到 500 错误。我最终将 cfchart 标记的范围缩小为问题,但在其中找不到任何语法错误,也没有任何逻辑错误。
<cfquery name="getData" datasource="#dsn#">
SELECT
( SELECT Count(UserID)
FROM Users
WHERE StripeCustomerID IS NOT NULL
) AS 'Licenses'
, COUNT(UserID) AS 'Registrations'
, UserID AS 'User'
FROM Users
WHERE DATEDIFF(hour, FirstContact, DateStamp) <= '12'
GROUP BY UserID
</cfquery>
<cfquery name="queryOfQuery" dbtype="query">
SELECT (Licenses/Registrations) AS Percent FROM getData
</cfquery>
<cfchart format="flash">
<cfchartseries type="bar"
query="queryOfQuery"
itemcolumn="UserID"
valuecolumn="Percent" />
</cfchart>
样本数据
Users Table Sample Data
UserID StripeCustomerID
35 cus_8LOSlmvEQcfg1g
36 cus_6ixCBe7aU1MJEt
50 NULL
60 cus_6ifLCNmR9rOBCl
69 NULL
70 NULL
72 NULL
73 NULL
74 NULL