I have a query like this
SELECT date_format( doj, '%d/%m/%Y' ) AS week ,
WHERE doj between '2012-01-01'
group BY WEEK(doj)
week COUNT(user_id)06/01/2012 317/01/2012 225/01/2012 329/01/2012 1
Jul 23, 2012 at 09:08 AM
Jul 23, 2012 at 09:19 AM
In mySQL? No idea.
In TSQL - SELECT DATEPART(wk,GETDATE()) returns 31 - ie the 31st week since the start of the calendar year.
Jul 23, 2012 at 12:17 PM
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.
Once you sign in you will be able to subscribe for any updates here
Answers and Comments
Need long-form SQL discussion? SQLserverCentral.com is the place.
asked: Jul 23, 2012 at 09:08 AM
Seen: 759 times
Last Updated: Jul 23, 2012 at 12:17 PM
how to backup a database in mysql server 5.0
sql server function to mysql with same logic
Is SQL Server catching up with Oracle or would it be a good career decision to develop in both?
writing a generalised sql query
How to port the Mysql server table into MS SQL server
Does DTS export destination database need to be installed?
duplicate value unable to insert in int column
Need Help with hour averages
Split data from mysql using json
ERROR #1064 --WHEN TRYING TO RUN A QUERY WITH JOINS