Ashok Karale

Ashok Karale

  • NA
  • 882
  • 312k

Inner Join Query incorrect result

Feb 13 2014 7:29 AM
Hi I am developing an application in VS 2010, C# and SQLCe database.

I am generating a report from 3 tables respectively Income, Expence and Transactions.

table structure is as below:

Income:

Hi I am developing an application in VS 2010, C# and SQLCe database.

I am generating a report from 3 tables respectively Income, Expence and Transactions.

table structure is as below:

Income:

Income

Expence:

expence

Transactions:

trans

For this I wrote query

select t.tDate as [Date], t.tDescription as [Detail],e.eAmount as [Debit],  
i.iAmount as [Credit], t.balance as [Balance] from Transactions t 
inner join Expence e on t.pid=e.pid join Income i on t.pid=i.pid  where t.pid='11'

But when I run this query I am just getting

result

I want that my result should be like a bank statement as below.

final

As per my understanding query is not right.

How can we write query to get result like this?


Answers (3)