From: Juan Riera Date: March 17 1999 7:06am Subject: Formatting date as week # - is it possible on mySQL? List-Archive: http://lists.mysql.com/mysql/386 Message-Id: <002301be7044$9f535c00$0100a8c0@p233.mygroup> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0020_01BE704D.00808D10" ------=_NextPart_000_0020_01BE704D.00808D10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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.=20 - 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 ------=_NextPart_000_0020_01BE704D.00808D10--