I am executing the following query, the source query has two columns with the correct names and all of the data in those columns are numeric, mostly zeros in both columns but a few actual numbers.
Any idea what is going on here?
What is being set the qryGetIdLengthSum variable?
SELECT SUM(item1_length) AS total_length, SUM(item2_end) AS total_end
FROM retCustomer_st.qryGetCustomers
Actually mysql.
Sorry I missed some of the code due to the html codes.
cfquery name=“qryGetTaxIdLengthSum” dbtype=“query”
SELECT SUM(item1_length) AS total_length, SUM(item2_end) AS total_end FROM retCustomer_st.qryGetCustomers
cfquery
The query is where I get the error.
Nothing is being set since the query never completes.
If I cfabort before the query closing tag then I get the query info which looks good bu if I try to execute the query I get the error above.
Here is the actual query now that I learned how to escape the code.
The dump before looks good, the dump after never executes if I remove the cfabort I get the error.
<cfdump var="#retCustomer_st.qryGetCustomers#">
<cfquery name="qryGetTaxIdLengthSum" dbtype="query">
SELECT SUM(tax_id_length) AS total_tax_length, SUM(use_period_end) AS total_period_end
FROM retCustomer_st.qryGetCustomers
<cfabort>
</cfquery>
<cfdump var="#qryGetTaxIdLengthSum#" abort="true">
address address_2 business_name city customer_id customer_status customer_tax_id tax_id_length drivers_license first_name last_name period_end_date state thumbnail use_period_end zip customer_type_name
1 10101 South Main Winsor 290086 1 0 Jonny Blue {ts '2013-04-25 00:00:00'} CO default_th 0 99909 Normal
2 6266 Skinny Back Lane Broke Back Mountain 112205 1 0 Bob Bobby {ts '2011-07-01 00:00:00'} MT default_th 0 61154 Normal
It is a little hard to read but tax_id_length is 0,0 and use_period_end is also 0,0.
All of the values in both columns are either 0 or an integer value.
I do not get a stack trace from lucee, I see the previous query in the debug screen and the one afterward that logs the error to the database.
Lucee (Velvet) Os 5.2.9.31 (CFML Version 2016,0,03,300357)
My MYSQL version is 5.7.25.
It is pretty clear as I play around with it that the first query is adding a column like this:
LENGTH(tax_id) as tax_id_length
I believe it is storing meta data for that column as text, then when it tries to sum it is recognizing that it cannot sum text even though it is a text representation of a number.
Is there a way to examine the metadata associated with the source query?
I have revised my code so that I can move on with development, but I have saved the bad code for testing.
It would be nice to understand what is going on here.
The query works in coldfusion 10,11, and 2018.
I also pulled the queries them selves and executed them in MySQL Workbench as a subquery of a query and they execute fine there.