Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8038499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:15:24+00:00 2026-06-05T03:15:24+00:00

I have a query called AllPosts from a query of a query. AllPosts has

  • 0

I have a query called AllPosts from a query of a query.

AllPosts has two results:

Row 1| ID: 2   PublishedDate: 2012-05-30 16:47:00.0
Row 2| ID: 3   PublishedDate: 2012-05-31 15:50:00.0

When I do a query of a query on AllPosts called FilterPosts using

WHERE PublishedDate BETWEEN '2012-05-01 00:00:00' AND '2012-05-31 23:59:00'

(Note that the actual query is doing cfqueryparam cf_sql_date for these values)

I expect FilterPosts to have the same rows as AllPosts, instead I only get ID 2. If I change ID 2’s published date to 2012-05-30 23:59:50.0, FilterPosts returns the correct results.

I have also tried

WHERE PublishedDate >= '2012-05-01 00:00:00'   
AND   PublishedDate <= '2012-05-31 23:59:00'   

There is something specifically odd with May 31st.

I’m pulling my hair out here! Thanks!

I tried scratch building a the original query, and oddly enough, same results!

<cfset test = queryNew("Name,PublishedDate", "VarChar, Time" )>
<cfset queryAddRow(test)>    
<cfset querySetCell(test,"PublishedDate","2012-05-30 16:47:00.0")>     
<cfset querySetCell(test,"Name","First Entry")>    
<cfset queryAddRow(test)>    
<cfset querySetCell(test,"PublishedDate","2012-05-31 15:47:00.0")>    
<cfset querySetCell(test,"Name","Second Entry")>    

<cfset StartDate = CreateDate(2012, 5, 1)>

<cfquery name="filter" dbtype="query">    
    SELECT Name, PublishedDate    
    FROM    test
WHERE    1=1
AND PublishedDate >= <cfqueryparam value="#StartDate#" cfsqltype="cf_sql_date">
AND PublishedDate <= <cfqueryparam value="#DateAdd( 'n', -1, DateAdd('m', 1, StartDate) )#" cfsqltype="cf_sql_date">
 </cfquery>

The results of Filter only has ‘FirstEntry’ rather than both like it should.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:15:25+00:00Added an answer on June 5, 2026 at 3:15 am

    Oddly enough it had to do with cfqueryparam. I had been using CreateDate() to create my start/end dates like this:

    <cfset StartDate = CreateDate(2012,5, 1)>
    

    I was using it in my SQL WHERE in the query of query like this:

    WHERE PublishedDate >=  <cfqueryparam value="#StartDate#" cfsqltype="cf_sql_date">
    

    It was cf_sql_date. It should be cf_sql_timestamp The date was capping it to 5-31, and thus anything posted later on in the day on 5-31 was omitted. The minutes were dropping.

    Thanks for everyone’s input.

    Fixing legacy code rocks!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a while loop from a query called $result . Inside this while
I have a reusable select query method called by two other methods. These are
I have a query in CakePHPthat has a stored datetime field called DropIn.drop_in_time .
I have a query to insert a row into a table, which has a
I have a class A, which has two functions (Download and query). When the
Say I have stored a query in a variable called $query. I want to
I have a text-field called name in my schema.xml . A query q=name:(organic) returns
I have query with two MtM relations: $em = $this->getEntityManager(); $qb = $em->createQueryBuilder(); $qb
I have query table copyQuery which has Soil Condition has one of the columns,
I have query like this : SELECT EXTRACT(MONTH FROM d.mydate) AS synmonth, SUM(apcp) AS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.