Could it be thread related? If I run something multiple times and get different results, I start thinking about race conditions. Is it possible that cfquery is creating a new thread and at the same time you custom tag is executing in the main thread? Hence you have some weird race condition. Perhaps you could run the order by custom tag before executing the cfquery?
"Greg Drake" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 05/21/2007 06:08 PM Please respond to discussion@acfug.org To discussion@acfug.org cc Subject Re: [ACFUG Discuss] Bad CFQuery Results Thanks Dusty, but I'm afraid I already tried that. It all came out how I expected it to. I ran the results directly through the database and it came out fine. For that matter, I ran the results back through the <cfquery> tag and it came out fine. Mischa, Debugging was a good idea. I never think of using that feature. However, it seems to be returning exactly what I would expect as well. Of course this time the <cfqueryparam> tags are all replaced with question marks and defined at the bottom. I still can't figure out what I'm missing here. I was really hoping that it was a common thing that I'd just never heard of before. On 5/21/07, Dusty Hale <[EMAIL PROTECTED]> wrote: > You may have tried this already or perhaps the query is rather complex (it > sounds like) but: > > 1. make a copy of it. > 2. remove all the cfqueryparam tags and replace with normal variables or > values. > 3. replace the cfquery tags with <cfouput><pre>code > here</pre><cfabort></cfouput> > 4. output the actual query text so you can see what is really being queried > and run the query out put manually to see if you get the results you're > looking for. > > Not sure if this is helpful for your situation or not but thought it > wouldn't hurt to suggest. Best of luck with the issue. > > Dusty > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Greg Drake > Sent: Monday, May 21, 2007 4:20 PM > To: discussion@acfug.org > Subject: [ACFUG Discuss] Bad CFQuery Results > > Has anyone else ever run into a situation where <cfquery> does not return > the same records as a direct query on the database? > > I have a rather large query joining 5 tables and 2 derived tables. The > 'where' clause is cluttered with dynamically loaded conditions. There are > some <cfqueryparam> tags that keep me from easily inserting the query as a > single string. The 'order by' clause is handled by a custom tag. > > The point is this: under certain circumstances the query does not respond > properly, but I am sure that the query should be making it to the <cfquery> > tag properly. If the query is run directly against the database it works > fine, and if it is run with certain options it works fine, but other options > make it return a result set that is too small. > It doesn't through an error, though, so If not for careful testing it > wouldn't have even been noticed. > > I am using ColdFusion 7 and SQL Server. > > Sorry for not posting any code, but I'm thinking you have either run into > this before or you haven't. I can't find anything online, perhaps because > the issue is difficult to describe. > > > ------------------------------------------------------------- > Annual Sponsor FigLeaf Software - http://www.figleaf.com > > To unsubscribe from this list, manage your profile @ > http://www.acfug.org?fa=login.edituserform > > For more info, see http://www.acfug.org/mailinglists Archive @ > http://www.mail-archive.com/discussion%40acfug.org/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > > > > > > ------------------------------------------------------------- > Annual Sponsor FigLeaf Software - http://www.figleaf.com > > To unsubscribe from this list, manage your profile @ > http://www.acfug.org?fa=login.edituserform > > For more info, see http://www.acfug.org/mailinglists > Archive @ http://www.mail-archive.com/discussion%40acfug.org/ > List hosted by http://www.fusionlink.com > ------------------------------------------------------------- > > > > ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com ------------------------------------------------------------- ------------------------------------------------------------- Annual Sponsor FigLeaf Software - http://www.figleaf.com To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ List hosted by http://www.fusionlink.com -------------------------------------------------------------