problem in my programme [Resolved]

Posted by Nuwan under ASP.NET on 6/15/2012 | Points: 10 | Views : 960 | Status : [Member] | Replies : 6
dear all

I have a sql table account_Detail. It has data like below,


date credit Debit

5/1/2012 1000.00 800.00
5/1/2012 2000.00 1000.00
5/2/2012 5000.00 1000.00
5/2/2012 800.00 1000.00
5/2/2012 2000.00 4000.00
5/3/2012 1000.00 1000.00



I want to write a programme(web or windows), it display record like below.

Date Sum(credit) Sum(debit)

5/1/2012 3000.00 1800.00
5/2/2012 7800.00 6000.00
5/3/2012 1000.00 1000.00


how I do that, Please help me.

Rathnayake


Responses

Posted by: CGN007 on: 6/15/2012 [Member] Silver | Points: 50

Up
0
Down

Resolved
Please use this query
SELECT entrydate,SUM(credit)Sumofcredit,SUM(debit) Sumofdebit FROM sampleTable GROUP BY entrydate


Hope this will solve your problem.

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Siva524 on: 6/15/2012 [Member] Starter | Points: 25

Up
0
Down
first of all you need to write sql query.in that query you have to provide date .
if you provide date then the query get the data (credit and debit).use sum() function
that's enough

select debit,credit from table name where date="5/12/2012" .
and also sum(credit) where date =" date here"
also sum(credit) where date="date here"

select debit,credit ,sum(credit),sum(debit) from table name where="5/12/2012".


Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 6/15/2012 [Member] Silver | Points: 25

Up
0
Down
Table script is
CREATE TABLE [dbo].[sampleTable](

[entrydate] [datetime] NULL,
[credit] [float] NULL,
[debit] [float] NULL
) ON [PRIMARY]



Insert your input in this table and run the select query that I already posted.


Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 6/18/2012 [Member] Silver | Points: 25

Up
0
Down
Have you tried that query?
let me know your comments...

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nuwan on: 6/18/2012 [Member] Starter | Points: 25

Up
0
Down
Its work. Thanks CGN007.

Rathnayake

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: CGN007 on: 6/18/2012 [Member] Silver | Points: 25

Up
0
Down
U r welcome...

Nuwan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response