datepart is SQL
In your stmt
>>datepart(q,#previousdate3#)
#previousdate3# should refer to a table field not a date value, so I am a
little confused as to what you are trying to do with the query.
But in a little more detail here is the SQL in action.
Data: sometable
SomeDate Qty Amt
01 Jan 2000 10 10.00
01 Mar 2000 10 20.00
01 May 2000 10 30.00
01 Jul 2000 10 40.00
01 Sep 2000 10 50.00
01 Nov 2000 10 60.00
01 Dec 2000 10 70.00
my query:
select datepart(q,SomeDate) as Qrt, sum(qty), sum(amt)
from sometable
group by datepart(q,SomeDate)
will return the dataset
Qrt SumQty SumAmt
1 20 30.00
2 10 30.00
3 20 90.00
4 20 130.00
Not sure if I understand what you want to do.
Eric
From: Shally <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
Subject: Re: Report
Date: Fri, 27 Apr 2001 08:18:22 -0700 (PDT)
Thanks for your mail.
But I am stuck in this query.
++++++++++++++++++++++++++
<cfset previousdate= DateAdd("d", -1, now())>
<cfset previousdate2=#DateFormat
previousdate,"mm/dd/yy")#>
<cfset
previousdate3=#DateFormat(previousdate,"mm/dd/yyyy")#>
<cfquery name="report7"
datasource="ShoppingCartReport"
dbtype="ODBC">
SELECT datepart(q,#previousdate3#) As
quarter,sum([Total Orders]) AS TotalOrders,
sum([Total Dollar Amount Of Sales]) AS
TotalDollarAmountOfSales
FROM [Sales Totals By Day]
GROUP BY datepart(q,#previousdate3#)>
++++++++++++++++++++++++++++++++++++++++++++++++
But this gives me an error.
Is datepart is some thing wich could be used in SQL.
Please help..
Shally.
--- Eric Dawson <[EMAIL PROTECTED]> wrote:
> select datepart(q,somedate) as
> quarter,sum(qty),sum(amt)
> from sometable
> group by datepart(q,somedate)
>
> Should give you a quarterly summary table .... I I
> understand the question
> .....
>
> Eric
>
> From: "Dave" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: CF-Talk <[EMAIL PROTECTED]>
> Subject: Re: Report
> Date: Fri, 27 Apr 2001 09:52:43 -0400
>
> calculate the cut-off dates thus:
>
> Now()
> DateAdd('m',-3,Now())
> DateAdd('m',-6,Now()))
> etc.,
>
> ----- Original Message -----
> From: "Shally" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Friday, April 27, 2001 9:30 AM
> Subject: RE: Report
>
>
> > Thanks for your reply.
> > I am unable to find any proper logic for my
> problem.
> > And well thats the problem:).
> > I am tried using "Quarter" function but it only
> gives
> > the the quarter number such as April is in 2nd
> > quarter.
> > Please help.
> > Shally.
> > --- Chris Maloney <[EMAIL PROTECTED]> wrote:
> > > Considering you didn't paste any errors that
> you
> > > have received with this the
> > > first thing I suggest you do is change the name
> of
> > > your date field from
> > > 'Date' to something else like 'myDate'. 'Date'
> is a
> > > reserved word in SQL and
> > > frequently causes problems because Access will
> not
> > > warn you of this when you
> > > are creating a table.
> > >
> > > Chris
> > >
> > > -----Original Message-----
> > > From: Shally [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, April 26, 2001 10:05 AM
> > > To: CF-Talk
> > > Subject: Report
> > >
> > >
> > > Hi Every one,
> > > I have an access table having 3 fields Date,
> > > Quantity
> > > and Amount.
> > > I am working on a report where I have to
> calculate
> > > the
> > > Quantity and Amount on quarterly bases for last
> year
> > > and this year.
> > > I tried using the function "Quarter" but an
> unable
> > > to
> > > reach any solution.Please help!!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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