Subject | Advice on following SQL string |
---|---|
Author | Andrew Gable |
Post date | 2011-06-21T18:32:23Z |
Hi all,
I have the following table in my database
SALEHISTORY
TRADEDATE VARCHAR(20);
BARCODENUMBER VARCHAR(13);
POSDESCRIPTION VARCHAR(20);
QTYSOLD VARCHAR(20);
LINETOTAL VARCHAR(20);
SALEGROUP VARCHAR(4);
What I am trying to do is get a weekly summary of all the sales for each
item PER DAY
Example
TRADEDATE BARCODENUMBER POSDESCRIPTION QTYSOLD
LINETOTAL SALEGROUP
2011/06/12 401440 M&M PEANUT BUTTER
1 0.99 0016
2011/06/12 02800082226 LAFFY TAFFY - CHERRY
1 0.59 0014
2011/06/14 401440 M&M PEANUT BUTTER
2 1.98 0016
2011/06/14 782640 A & W CREAM SODA
1 0.99 0001
The report should look like
BARCODENUMBER POSDESCRIPTION DATE
12/06/2011 14/06/2011
401440 M&M PEANUT BUTTER
1 2
02800082226 LAFFY TAFFY - CHERRY
1
782640 A & W CREAM SODA
1
I have NO IDEA how to write the SQL Statement to deal with this (at the
moment i am looping through the database and adding each number at a
Time and this still does not work correctly)
Any advice or even some sample SQL statements would be most welcome
Andy
[Non-text portions of this message have been removed]
I have the following table in my database
SALEHISTORY
TRADEDATE VARCHAR(20);
BARCODENUMBER VARCHAR(13);
POSDESCRIPTION VARCHAR(20);
QTYSOLD VARCHAR(20);
LINETOTAL VARCHAR(20);
SALEGROUP VARCHAR(4);
What I am trying to do is get a weekly summary of all the sales for each
item PER DAY
Example
TRADEDATE BARCODENUMBER POSDESCRIPTION QTYSOLD
LINETOTAL SALEGROUP
2011/06/12 401440 M&M PEANUT BUTTER
1 0.99 0016
2011/06/12 02800082226 LAFFY TAFFY - CHERRY
1 0.59 0014
2011/06/14 401440 M&M PEANUT BUTTER
2 1.98 0016
2011/06/14 782640 A & W CREAM SODA
1 0.99 0001
The report should look like
BARCODENUMBER POSDESCRIPTION DATE
12/06/2011 14/06/2011
401440 M&M PEANUT BUTTER
1 2
02800082226 LAFFY TAFFY - CHERRY
1
782640 A & W CREAM SODA
1
I have NO IDEA how to write the SQL Statement to deal with this (at the
moment i am looping through the database and adding each number at a
Time and this still does not work correctly)
Any advice or even some sample SQL statements would be most welcome
Andy
[Non-text portions of this message have been removed]