List:General Discussion« Previous MessageNext Message »
From:Juan Riera Date:March 17 1999 7:06am
Subject:Formatting date as week # - is it possible on mySQL?
View as plain text  
Hi,
I have been using the next Access Jet query to summarize my sales data by week:

SELECT Sum(sales) AS week_sales, Val(Format(date,"ww",2,2)) AS week_no
FROM [table]
GROUP BY Val(Format(date,"ww",2,2))
ORDER BY Val(Format(date,"ww",2,2));

I am using two VB functions, VAL() and FORMAT(). In FORMAT() function I use two VB
constants:
- vbMondays set to 2 allows week counter start on mondays,
- vbFirstFourDays set to 2 allows week counting on year to start on first week with four
or more days (I could choose alternatively 1 to start on Jan 1st)

I am quite new to SQL. I want to export my database to mySQL, and I would like to express
this query on plain SQL, but I know only YEAR() and MONTH() built-in functions. 
- Is there any SQL function that formats date as week ?
- Is there any way of defining a function on SQL to do that?

Thanks,
Juan

Thread
Formatting date as week # - is it possible on mySQL?Juan Riera17 Mar
Re: Formatting date as week # - is it possible on mySQL?johan.engstrom17 Mar
RE: Formatting date as week # - is it possible on mySQL?Juan Riera18 Mar