Click here to Skip to main content
15,888,351 members
Home / Discussions / Database
   

Database

 
GeneralRe: date format problem with asp & mssql. Help! Pin
dansoft9-Feb-06 7:37
dansoft9-Feb-06 7:37 
GeneralRe: date format problem with asp & mssql. Help! Pin
Dave Kreskowiak9-Feb-06 11:10
mveDave Kreskowiak9-Feb-06 11:10 
GeneralRe: date format problem with asp & mssql. Help! Pin
dansoft9-Feb-06 14:37
dansoft9-Feb-06 14:37 
Questioninserting images Pin
Net-Programer-and-developer7-Feb-06 5:30
Net-Programer-and-developer7-Feb-06 5:30 
AnswerRe: inserting images Pin
Dave Kreskowiak7-Feb-06 7:59
mveDave Kreskowiak7-Feb-06 7:59 
Questionsql server credentials Pin
Dimitris Iliopoulos7-Feb-06 4:47
Dimitris Iliopoulos7-Feb-06 4:47 
AnswerRe: sql server credentials Pin
Mike Dimmick7-Feb-06 5:45
Mike Dimmick7-Feb-06 5:45 
QuestionCumalative Sum and Supply/Demand Delay Pin
T-Smooth7-Feb-06 4:41
T-Smooth7-Feb-06 4:41 
Hi,

I have a table consisting of the following columns of relevance:

Day - Integer ranging from 1-9
Demand_Qty - Double value specifying the demand for that particular day.
Demand_Filled - Doulbe value specifying how much of the item was recieved that day.

What I need to find out is how many days it takes before each demand is filled. For example:

Day Demand_Qty Demand_Filled Days_to_Fill
1 10 0 2
2 10 0 2
3 20 10 1
4 5 30 1
5 10 10 -1

The first 3 columns are provided and the Days_to_Fill column is what I need to calculate. A -1 in the Days_To_Fill means the demand was never met. As you can see, the Demand for Day 1 is 10, which is not filled until Day 3. If further clarification is needed, pls inquire.

I'm not sure exactly where to begin so any tips/ideas/solutions would be greatly appreciated. One thing that I believe could get me closer to a solution would be acquiring a cumalative sum of Demand_Qty and Demand_Filled for each day, but I don't know how to do this in SQL... anyone know how? What I mean is a sum that would look like this based on the above sample:

Day SumDemand SumFilled
1 10 0
2 20 0
3 40 10
4 45 40
5 55 50

Thank you for any help in advance, hoping I can get a solution figured out soon for my Project Manager.

-Tom
QuestionIf statement in select clause... Help! Pin
awisey7-Feb-06 4:25
awisey7-Feb-06 4:25 
AnswerRe: If statement in select clause... Help! Pin
Mike Ellison7-Feb-06 5:56
Mike Ellison7-Feb-06 5:56 
AnswerRe: If statement in select clause... Help! Pin
Michael Potter7-Feb-06 5:58
Michael Potter7-Feb-06 5:58 
QuestionSQL & DAO Connection Pin
paykani6-Feb-06 18:00
paykani6-Feb-06 18:00 
AnswerRe: SQL & DAO Connection Pin
Dave Kreskowiak7-Feb-06 7:56
mveDave Kreskowiak7-Feb-06 7:56 
QuestionSQL Server Express 2005 Pin
Bassam Abdul-Baki6-Feb-06 15:41
professionalBassam Abdul-Baki6-Feb-06 15:41 
QuestionPluggable Reports Pin
ProffK6-Feb-06 10:19
ProffK6-Feb-06 10:19 
QuestionHow to menage concurrency with timestamp (C#) Pin
ventomito6-Feb-06 7:00
ventomito6-Feb-06 7:00 
AnswerRe: How to menage concurrency with timestamp (C#) Pin
Edbert P6-Feb-06 15:46
Edbert P6-Feb-06 15:46 
QuestionDatabase Auditing (Urgent) Pin
Roro Adel6-Feb-06 4:08
Roro Adel6-Feb-06 4:08 
AnswerRe: Database Auditing (Urgent) Pin
Alex Deem6-Feb-06 4:41
Alex Deem6-Feb-06 4:41 
QuestionAllow remote host with MySQL Pin
Paul Watson6-Feb-06 2:06
sitebuilderPaul Watson6-Feb-06 2:06 
AnswerRe: Allow remote host with MySQL Pin
Edbert P6-Feb-06 15:50
Edbert P6-Feb-06 15:50 
GeneralRe: Allow remote host with MySQL Pin
Paul Watson6-Feb-06 22:52
sitebuilderPaul Watson6-Feb-06 22:52 
GeneralRe: Allow remote host with MySQL Pin
Edbert P7-Feb-06 12:03
Edbert P7-Feb-06 12:03 
QuestionMS SQL 2000 Enterprise server and C# Windows App. Pin
cbhkenshin6-Feb-06 1:08
cbhkenshin6-Feb-06 1:08 
AnswerRe: MS SQL 2000 Enterprise server and C# Windows App. Pin
Colin Angus Mackay6-Feb-06 2:11
Colin Angus Mackay6-Feb-06 2:11 

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.