Click to See Complete Forum and Search --> : SQL


Richard Yeap
September 1st, 1999, 03:35 AM
Dear friend, I always get this message

---------------------------------------------------------------------------
You tried to execute a querry that doesn't include the specified expression 'FORMAT(Start_Date, "ttttt")' as part of an aggregate function.
---------------------------------------------------------------------------
Can anyone explain to me why I always get this message when I tried to get some information from the SQL server. my code is as below:


{"SELECT FORMAT(Start_Date, "yyyy"), FORMAT(Start_Date, "mm"), FORMAT(Start_Date, "ttttt"), FORMAT(Start_Date, "Short Date"), FORMAT(Start_Date, "ww") AS Week"}

{", SUM(Qty_IN) AS [Total Qty IN], Sum(Qty_OUT) AS [Total Qty OUT], Sum(ASSIST) AS [Total Assists], Sum(FAIL) AS [Total Failure], Sum(Lapsed_Time) AS [Total Lapsed Time]"}

{" FROM [;database=D:\iCONext\LOG\1998-06.mdb].LogPerformance"}

{" WHERE FORMAT(Start_Date, "yyyy") BETWEEN 1998 AND 1998 AND FORMAT(Start_Date, "ww") BETWEEN 24 AND 24"}

{" GROUP BY FORMAT(Start_Date, "yyyy"), FORMAT(Start_Date, "mm"), FORMAT(Start_Date, "ww")"}

{" ORDER BY FORMAT(Start_Date, "yyyy")+FORMAT(Start_Date, "mm")+FORMAT(Start_Date, "ttttt")"}




Thanks

dmadden
September 1st, 1999, 06:39 AM
I'm confused...

1.) Where is the FORMAT(...) coming from C++ or SQL???? Let me know and I will try to help more!

2.) Your Statement:

FORMAT(Start_Date, "yyyy") BETWEEN 1998 AND 1998 AND FORMAT(Start_Date, "ww") BETWEEN 24 AND 24

BETWEEN (in BOTH places) is NOT needed...just say:

FORMAT(Start_Date, "yyyy") = 1998 AND FORMAT(Start_Date, "ww") = 24

3.) Since I've looked in SQL Books Online & VC++ and can't find this FORMAT??? The following is a guess:

FORMAT(Start_Date, "ttttt") ...... Possibly use only 4 t's and not 5.


Thanks in advance,

Dan

September 1st, 1999, 08:31 AM
You are trying to FORMAT the information contained in the column Start_Date in 5 different ways?

What exactly are you trying to accomplish?