473,418 Members | 2,043 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,418 software developers and data experts.

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

27
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...
Problem..


Thankyou.........
Jul 28 '10 #1
3 1366
gpl
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, 
  2.  
  3. (Select Sum(Amount) from (your original query goes here) r where r.[date] LE s.[date]) as Running
  4.  
  5. From (
  6. your original query goes here
  7. ) s
Aug 3 '10 #2
MrMob
27
Plz Sir..


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

Your Disciples..
Aug 11 '10 #3
gpl
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

9
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?...
3
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...
0
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...
4
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
0
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...
5
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...
0
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...
1
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...
1
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...
3
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....
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.