Jump to content

Help with query


kevinfwb

Recommended Posts

I'm stumped and I need some help with a MySQL query.

 

I have a table that keeps track of sales and has the following fields:

 

storeNum = the company assigned number to the stores

week - the week of the recorded sales

period - the period of the recorded sales

year - the year of the recorded sales

month - the month the recorded sales

sales - the dollar amount of the sales

 

Our fiscal year is divided into 13 periods with 4 weeks in each period.

 

I'm trying to create a query that will give me all 4 weeks of sales in a given period.

 

Store    Period 1      Week 1    Week 2  Week 3  Week 4

1234        1            $8400      $6500    $7412    $7142

 

I have the following query, but it gives me 4 separate rows instead of one row.

 

SELECT storeNum, sales FROM Sales WHERE period = 12 AND year = 2007;

 

I hope that I've provided enough information as to what I'm looking for.  I know that it's not an incredibly difficult query, I'm just stumped at the moment.

 

Thanks

 

-Kevin 

 

Link to comment
https://forums.phpfreaks.com/topic/82554-help-with-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.