Skip to main content
Participating Frequently
July 21, 2008
Question

CFQUERY Issue

  • July 21, 2008
  • 2 replies
  • 299 views
Group -

I have an Access Database that I'm trying to query. I'm trying to return all the records that's greater than 01/01/2003 for a particular company. The query works fine as long as have one or the other conditions but not when I include the AND to have both conditions. No results are displayed. Is this some kind of Access issue?

Any help would be appreciated.

<cfset new_date = #createodbcdatetime("1/1/2003")#>

<cfquery name="display" datasource='car'>
select [car id] as carid, [car date] as cardate
from [corrective actions] where [car date] > #new_date# and [car id] = 4599
</cfquery>

<cfoutput query='display'> #carid# -- #cardate# </cfoutput>
    This topic has been closed for replies.

    2 replies

    Inspiring
    July 21, 2008
    bbagwell wrote:
    > Is this some kind
    > of Access issue?

    Probably. The issue is most likely that your Access database
    'corrective actions' table has no records where 'car id' is 4599 after
    the 'car date' of 1/1/2003.

    If that is not a true statement then we will probably need to know more
    about your data and database design.
    Inspiring
    July 21, 2008
    Sounds to me like the data that you are asking for doesn't exist in your database. Running only Car Date > 1/1/2003 brings up some information and running only Car Id = 4599 returns some, but there are no rows that these two have in common.

    If you are positive that there are, I would say go through and double check.
    <cfquery name="display" datasource='car'>
    select [car id] as carid, [car date] as cardate
    from [corrective actions] where [car date] > #new_date#
    order by [car id]
    </cfquery>
    <cfdump var="#display#">
    Dump this query out and manually look for any rows that have car id of 4599