nohandlesleft254
IS-IT--Management
Hi,
I have a main query that i use to get all invoices for the last 6/12/18/24 months. I am then trying to use QofQ to obtain the information for the months individually, but i get an error;
*Query Of Queries syntax error.
Encountered "Date. Incorrect Select List, Incorrect select column,*
but Date clearly is in the query?... what am i missing?
Main Query-
<cfquery name="FindUsageLevels" datasource="#Application.HansaData#">
SELECT
SerNr,
CONVERT(DATETIME, OrdDate, 103) AS Date,
CAST(Sum4 AS MONEY) AS Sum4
FROM SALESORDERS
WHERE Sum4 <> ''
AND CONVERT(DATETIME, OrdDate, 103) BETWEEN '#FromDate#' AND '#LASTDAYTHISMONTH#'
</cfquery>
First QofQ -
<cfquery name="Month11" dbtype="query">
SELECT
Date,
SUM(Sum4) AS MonthTotal
FROM FindUsageLevels
WHERE Date BETWEEN '#FIRSTDAYTHISMONTH11#' AND '#LASTDAYTHISMONTH11#'
</cfquery>
I have a main query that i use to get all invoices for the last 6/12/18/24 months. I am then trying to use QofQ to obtain the information for the months individually, but i get an error;
*Query Of Queries syntax error.
Encountered "Date. Incorrect Select List, Incorrect select column,*
but Date clearly is in the query?... what am i missing?
Main Query-
<cfquery name="FindUsageLevels" datasource="#Application.HansaData#">
SELECT
SerNr,
CONVERT(DATETIME, OrdDate, 103) AS Date,
CAST(Sum4 AS MONEY) AS Sum4
FROM SALESORDERS
WHERE Sum4 <> ''
AND CONVERT(DATETIME, OrdDate, 103) BETWEEN '#FromDate#' AND '#LASTDAYTHISMONTH#'
</cfquery>
First QofQ -
<cfquery name="Month11" dbtype="query">
SELECT
Date,
SUM(Sum4) AS MonthTotal
FROM FindUsageLevels
WHERE Date BETWEEN '#FIRSTDAYTHISMONTH11#' AND '#LASTDAYTHISMONTH11#'
</cfquery>