获取查询查询错误

编程入门 行业动态 更新时间:2024-10-28 06:36:25
本文介绍了获取查询查询错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用以下代码,想知道为什么会出现 Queries of Queries错误?

I am using the following code and wondering why I am getting "Queries of Queries" error?

<cfquery name="findpercentage" datasource="#mydatasource#"> SELECT Count(TableId_bi) AS Total_Events ,Sum(CASE WHEN 'OPEN' = Event_vch THEN 100 END) / Count(*) AS OPENS ,Sum(CASE WHEN 'BOUNCE' = Event_vch THEN 100 END) / Count(*) AS BOUNCE ,Sum(CASE WHEN 'DEFERRED' = Event_vch THEN 100 END) / Count(*) AS DEFERRED ,Sum(CASE WHEN 'DROPPED' = Event_vch THEN 100 END) / Count(*) AS DROPPED ,Sum(CASE WHEN 'DELIVERED' = Event_vch THEN 100 END) / Count(*) AS DELIVERED ,Sum(CASE WHEN 'PROCESSED' = Event_vch THEN 100 END) / Count(*) AS PROCESSED ,Sum(CASE WHEN 'SPAMREPORT' = Event_vch THEN 100 END) / Count(*) AS SPAMREPORT FROM mydatabase; </cfquery> <cfdump var="#findpercentage#"> <cfquery name = "piechartdisplay" dbtype = "query"> SELECT OPENS as Ecount, 'Open' as type from findpercentage UNION SELECT BOUNCE as Ecount, 'Bounce' as type from findpercentage UNION SELECT DEFERRED as Ecount, 'Deferred' as type from findpercentage UNION SELECT DROPPED as Ecount, 'Dropped' as type from findpercentage UNION SELECT DELIVERED as Ecount, 'Delivered' as type from findpercentage UNION SELECT PROCESSED as Ecount, 'Processed' as type from findpercentage UNION SELECT SPAMREPORT as Ecount, 'Spamreport' as type from findpercentage </cfquery> <cfdump var="#piechartdisplay#">

查询的第一部分是将适当的内容转储到网页上,但是,第二次尝试 piechartdisplay正在生成查询或查询错误。错误描述如下:

The first part of the query is dumping propery on the webpage, however, the second dumping attempt of "piechartdisplay" is generating Query or Query error. The error description is as follows:

Error Executing Database Query. Query Of Queries syntax error. Encountered "DEFERRED. Incorrect Select List, Incorrect select column, The error occurred in C:\Path\myfile.cfm: line 39 37 : 38 : 39 : <cfquery name = "piechartdisplay" dbtype = "query"> 40 : 41 : SELECT OPENS as Ecount, 'Open' as type SQL SELECT OPENS as Ecount, 'Open' as type from findpercentage UNION SELECT BOUNCE as Ecount, 'Bounce' as type from findpercentage UNION SELECT DEFERRED as Ecount, 'Deferred' as type from findpercentage UNION SELECT DROPPED as Ecount, 'Dropped' as type from findpercentage UNION SELECT DELIVERED as Ecount, 'Delivered' as type from findpercentage UNION SELECT PROCESSED as Ecount, 'Processed' as type from findpercentage UNION SELECT SPAMREPORT as Ecount, 'Spamreport' as type from findpercentage

我必须像下面这样传递来自上面查询的数据(在它开始无错运行之后),这就是为什么我这样写我的QoQ如上:

I have to pass the data from above query(after it starts running without errors) like the following, and that's why I wrote my QoQ like above:

<cfset dataItem =[ '#type#', '#Ecount#' ]>

请告知我这里的错误所在。

Please advise where I am wrong here.

推荐答案

错误提示,递延是保留字( 查询中的保留字)。将其别名化为原始查询中的其他内容,或者尝试在QoQ中使用方括号将其转义。

As implied by the error, deferred is a reserved word ("Reserved words in queries"). Alias it as something else in your original query, or try escaping it with square brackets in the QoQ.

更多推荐

获取查询查询错误

本文发布于:2023-10-27 02:39:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532060.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!