Got it, a little more digging did the trick.

CONVERT(char(12), t1.date1, 107) = CONVERT(char(12), t2.date2, 107)



-----Original Message-----
From: Duane Boudreau [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 14, 2001 1:17 PM
To: CFTalk
Subject: SQL Convert and joining on date


Hi All,

In a query I am working on I am trying to do a join based on date, but all
dates are stored as yyyy-mm-dd hh:mm:ss (small date) and I want to join
based on yyyy-mm-dd.

I can not find any actual samples in SQL BOL on using the CONVERT function
to format dates. Can some lend a hand?

<cfquery ....>
        SELECT SUM(t1.f1) AS totF1,
             SUM(t2.f2) AS totF2,

        FROM     t1, t2
        WHERE    CONVERT(t1.datefield,?????) = CONVERT(t2.datefield,?????)
        ....
</cfquery ....>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to