473,372 Members | 1,051 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

how to add in column on each day to as on day...

Hellow Sir,

when i group with DATE from the Table it shows this result...

DATE Amount

04/01/2009 100
04/03/2009 200
04/04/2009 300
04/05/2009 400
04/06/2009 500
04/08/2009 -700
04/09/2009 800
04/10/2009 1000
04/12/2009 200
04/13/2009 50
04/14/2009 200
04/15/2009 300
04/16/2009 400
04/17/2009 500

BUT i need to get the Result as Below...

DATE Amount Amount

4/1/2009 100 100
4/3/2009 200 300
4/4/2009 300 600
4/5/2009 400 1000
4/6/2009 500 1500
4/8/2009 -700 800
4/9/2009 800 1600

and so on...

that is ... Each day the amount should be added
for the date (04/04/2009 amount is added as 100+200+300)
Using Cursor ..... or any kind...

Jul 28 '10 #1
3 1363
152 100+
Realistically, you should be doing this calculation in the front-end / report code, however what you need to do is to calculate the sum of all amounts for dates that are less than - or equal to - the date of the current row.

Something like this (not tested as I dont know your original code) - note that it will get very inefficient with increasing numbers of rows returned in the original query
Expand|Select|Wrap|Line Numbers
  1. Select [date], amount, 
  3. (Select Sum(Amount) from (your original query goes here) r where r.[date] LE s.[date]) as Running
  5. From (
  6. your original query goes here
  7. ) s
Aug 3 '10 #2
Plz Sir..

WIll you Little Elaborate more clearly with some life good Examples..
I would be glad Enough to solve it..

Your Disciples..
Aug 11 '10 #3
152 100+
If you would post the query that you developed to give you the results in your first post, I will try to give you a good example
Aug 11 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: DMAC | last post by:
If i want to split a computed column into two or more columns based on the the length (its a varchar) of the computed column, how often will sql server determine what the computed column is?...
by: Yeah | last post by:
I have an HTML table with two columns of text. Here's what it looks like: FIRST COLUMN (each cell is ID="date') Background orange, font Serif size 13px, aligned center SECOND COLUMN (each cell...
by: Manish | last post by:
Hey Guys I am using a datagrid to extract information out of SQL Server datbase. The fields extracted are category,week,budget,Last Year,Forecast and Projection. Also i add a calculated column...
by: bei | last post by:
Hi, I am trying to write several arrays into one file, with one arrays in one column. Each array (column) is seperated by space. ie. a= b= c= 1 5 9 2 6 10 3 7 11 4 8 12
by: kowndinya | last post by:
Hai, I have created a program in vb6 , MSChart and it is working fine. This chart shows monthly sales values ( columncount =1) and chart type is vtChChartType2DBar my problem is, I want to add...
by: Ken | last post by:
I'm trying to run a loop to capture column property information from a table in my datasource. Can anybody see where this is going wrong? Dim tbl As New DataTable Dim col As DataColumn Dim x...
by: Chran | last post by:
Hi everybody, I am working on a search function for an e-commerce site and I just cant figure this one out. It is probably not that hard but I am stuck. The search is searching three columns in...
Death Slaught
by: Death Slaught | last post by:
I will be showing you how to make a very simple but effective three column layout. First we will begin with the HTML, or structure, of our three column layout. <!DOCTYPE html PUBLIC...
by: ll | last post by:
Hi all, I've inherited a site and am currently looking to redesign a page that displays a table of course curriculum, with each row representing a "Topic" of the curriculum. There is a courseID...
by: mcfly1204 | last post by:
I have a recipe table that consists of a recipe id as well as seven column, each of the seven columns consisting of an ingredient. I would like to create a separate row for each column in the row....
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.