Try putting hashes around dos and using = rather than LTE.  You also have a
bracket missing around your ABS function like so:

<CFQUERY name="getkundeinfo" datasource="abx2" dbtype="ODBC">
        select distinct forsikring.*,kunde.*
        from forsikring, kunde
        where  kunde.kundenr = #kundenr2# AND forsikring.id = #salg# AND 
        forsikring.id = kunde.id and Abs(datediff("d", #dos#, #dos2#)) = 30
</CFQUERY>

If this doesn't work try replacing the "d" in the datediff function with
"dd" or "day"

------------------------------------------------------------------ 
Andrew Ewings
Project Manager
Thoughtbubble Ltd 
http://www.thoughtbubble.net 
------------------------------------------------------------------ 
United Kingdom 
http://www.thoughtbubble.co.uk/ 
Tel: +44 (0) 20 7387 8890 
------------------------------------------------------------------ 
New Zealand 
http://www.thoughtbubble.co.nz/ 
Tel: +64 (0) 9 419 4235 
------------------------------------------------------------------ 
The information in this email and in any attachments is confidential and
intended solely for the attention and use of the named addressee(s). Any
views or opinions presented are solely those of the author and do not
necessarily represent those of Thoughtbubble. This information may be
subject to legal, professional or other privilege and further distribution
of it is strictly prohibited without our authority. If you are not the
intended recipient, you are not authorised to disclose, copy, distribute, or
retain this message. Please notify us on +44 (0)207 387 8890. 



-----Original Message-----
From: Dominic J. Doucet-Lorang [mailto:[EMAIL PROTECTED]]
Sent: 24 October 2000 13:01
To: CF-Talk
Subject: query problem


Is there some way of incorperating the datediff function into a query?  I 
am trying to get only records that have a date difference of 30 days.
   Here is the query:
<CFQUERY name="getkundeinfo" datasource="abx2" dbtype="ODBC">
        select distinct forsikring.*,kunde.*
        from forsikring, kunde
        where  kunde.kundenr = #kundenr2# AND forsikring.id = #salg# AND 
forsikring.id = kunde.id and Abs(datediff("d", dos, #dos2#) LTE 30
</CFQUERY>

the variables dos & dos2 are created using CreateODBCDate.


Thanks in advance,


Dominic

----------------------------------------------------------------------------
--------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a
message with 'unsubscribe' in the body to [EMAIL PROTECTED]
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to