Skip to main content
June 27, 2014
Question

A strange query of queries bug in CF11?

  • June 27, 2014
  • 2 replies
  • 1262 views

Hi,

I have this strange query of queries result that could be a bug in CF11.  The result is fine in CF10.

Basically, I have 2 queries, qrA and qrB.  I do a join of the two in joinQr, after which I do a query of qrA.  Since I didn't alter qrA in any way, I would expect newQrA to give me the same result as qrA.  However it only gives me one row ("D").  Now, here's the strange thing:  If I start off qrA with the letters in ascending order ["A", "B", "C", "D"], then newQrA gives me the right result.

<cfset qrA = queryNew("")>

<cfset queryAddColumn( qrA, "size", "varchar", [ "D", "A", "B", "C" ] )>

<cfset qrB = queryNew("")>

<cfset queryAddColumn( qrB, "size", "varchar", [ "A" ] )>

<cfset queryAddColumn( qrB, "quantity", "integer", [ 0 ] )>

<cfquery name="joinQr" dbtype="query">

    select qrA.*, qrB.quantity

    from qrA, qrB

    where qrA.size = qrB.size

</cfquery>

<cfquery name="newQrA" dbtype="query">

    select *

    from qrA

</cfquery>

<cfdump var="#qrA#">

<cfdump var="#qrB#">

<cfdump var="#joinQr#">

<cfdump var="#newQrA#">

This topic has been closed for replies.

2 replies

BKBK
Community Expert
Community Expert
June 28, 2014

I made an error when I first tested your code with array variable names instead. However, I have now been able to reproduce your result. It indeed looks like a bug.

Participating Frequently
June 27, 2014

it'd help if you showed us what these queries look like, and possibly some sample data.

June 27, 2014

Sorry, I had trouble inserting the code earlier.  It's fixed now.

BKBK
Community Expert
Community Expert
June 28, 2014

For your interest, by coincidence, my first test was with

<cfset queryAddColumn( qrA, "size", "varchar", [ "A","B","C","D" ] )> 


It turns out that the order "A","B","C","D" works, whereas "D","A","B","C" fails. Quite funny, really.