Click here to Skip to main content
15,881,898 members
Home / Discussions / Database
   

Database

 
GeneralRe: dynamically change column name Pin
PIEBALDconsult25-Mar-11 16:00
mvePIEBALDconsult25-Mar-11 16:00 
GeneralRe: dynamically change column name Pin
Eddy Vluggen26-Mar-11 1:52
professionalEddy Vluggen26-Mar-11 1:52 
GeneralRe: dynamically change column name Pin
jschell25-Mar-11 8:29
jschell25-Mar-11 8:29 
GeneralRe: dynamically change column name Pin
PIEBALDconsult25-Mar-11 16:16
mvePIEBALDconsult25-Mar-11 16:16 
GeneralRe: dynamically change column name Pin
Eddy Vluggen26-Mar-11 2:04
professionalEddy Vluggen26-Mar-11 2:04 
GeneralRe: dynamically change column name Pin
jschell26-Mar-11 6:08
jschell26-Mar-11 6:08 
GeneralRe: dynamically change column name Pin
Wendelius26-Mar-11 3:38
mentorWendelius26-Mar-11 3:38 
QuestionHow to calculate average of qty sold the last 6 months or less Pin
Joe Smith IX23-Mar-11 23:50
Joe Smith IX23-Mar-11 23:50 
Table [Sold]

ID PID Qty Date
-- --- --- ---------
1  1   8   jun 1, 2010
2  3   5   jul 1, 2010
3  3   2   aug 1, 2010
4  1   1   sep 1, 2010
5  3   4   sep 30, 2010
6  2   3   oct 8, 2011
7  2   5   nov 1, 2011
8  3   2   dec 1, 2011
9  1   8   jan 1, 2011
10 2   5   feb 1, 2011

Hi all,

I have difficulty composing a rather complex (for me) query. I would like to know the average qty sold of each PID per day based on the last 6-month data. If data is less than 6 month, then adjust accordingly.

So on the data above:
Today: Mar 24, 2011
6-month cut-off: Sep 24, 2010
I want to get:
PID Qty/day
--- -------
1   8/182       = 0.0440
2   (3+5+5)/168 = 0.0774 -> 168: because the oldest sale is oct 8
3   (4+2)/182   = 0.0330


Is there any way I can do this? Somebody help me, please? Thanks in advance.
AnswerRe: How to calculate average of qty sold the last 6 months or less [modified] Pin
Chris Meech24-Mar-11 2:52
Chris Meech24-Mar-11 2:52 
GeneralRe: How to calculate average of qty sold the last 6 months or less Pin
Joe Smith IX24-Mar-11 18:10
Joe Smith IX24-Mar-11 18:10 
GeneralRe: How to calculate average of qty sold the last 6 months or less Pin
Klaus-Werner Konrad25-Mar-11 7:11
Klaus-Werner Konrad25-Mar-11 7:11 
GeneralRe: How to calculate average of qty sold the last 6 months or less Pin
Chris Meech25-Mar-11 7:20
Chris Meech25-Mar-11 7:20 
GeneralRe: How to calculate average of qty sold the last 6 months or less Pin
Klaus-Werner Konrad25-Mar-11 14:50
Klaus-Werner Konrad25-Mar-11 14:50 
AnswerRe: How to calculate average of qty sold the last 6 months or less Pin
Mycroft Holmes24-Mar-11 12:59
professionalMycroft Holmes24-Mar-11 12:59 
GeneralRe: How to calculate average of qty sold the last 6 months or less Pin
Joe Smith IX24-Mar-11 18:10
Joe Smith IX24-Mar-11 18:10 
QuestionFInd Sundays only Pin
rakeshs31223-Mar-11 21:25
rakeshs31223-Mar-11 21:25 
AnswerRe: FInd Sundays only Pin
Wendelius23-Mar-11 22:51
mentorWendelius23-Mar-11 22:51 
GeneralRe: FInd Sundays only Pin
J4amieC23-Mar-11 23:13
J4amieC23-Mar-11 23:13 
GeneralRe: FInd Sundays only Pin
Wendelius23-Mar-11 23:27
mentorWendelius23-Mar-11 23:27 
GeneralRe: FInd Sundays only [modified] Pin
J4amieC23-Mar-11 23:38
J4amieC23-Mar-11 23:38 
GeneralRe: FInd Sundays only Pin
Wendelius24-Mar-11 0:09
mentorWendelius24-Mar-11 0:09 
GeneralRe: FInd Sundays only Pin
rakeshs31224-Mar-11 0:22
rakeshs31224-Mar-11 0:22 
GeneralRe: FInd Sundays only Pin
Wendelius24-Mar-11 4:05
mentorWendelius24-Mar-11 4:05 
AnswerRe: FInd Sundays only Pin
J4amieC23-Mar-11 23:12
J4amieC23-Mar-11 23:12 
QuestionNeed help with updating columns Pin
Slow Learner23-Mar-11 3:15
Slow Learner23-Mar-11 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.