Jump to content

Help with monitoring year week and sales figures


marksie1988

Recommended Posts

Hi,

 

i am looking into creating an application in php mysql that we could put sales figures in for the week etc.

 

i am a bit confused though as to how i could go about working out the weeks e.g. there are 52 weeks in a year, i need the application to know what week it is (how would i achieve this?) and also say i went from 2009 to 2010 i would need it to go back to week 1.

 

the main issue that i have is that i do need to keep the history of sales etc so that we can do a YTD figure and a weekly figure.

 

all i need is some help or ideas or code snipets that would allow me to have 2009 week 1 to week 52 then move to 2010 week 1 to week 52 if you need more explanation please dont hesitate to ask.

 

 

any help is much appreciated

 

Regards

Steve

Link to comment
Share on other sites

Mysql has a large number of date/time functions that you can use to query for the data you are interested in, for example you could GROUP BY using the WEEK() function to get weekly figures for a range of dates - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_week (see the page that link is part of for more useful date/time functions.)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.