I have this one also that I cannot conquer.
I have two tables - one called Votes with fields VoteNumber and VoteName - and one called Transactions with the following fields : ID, Transdate, Description, DebitVoteNumber, CreditVoteNumber, Transtype (1 for Income and 2 for Expenditure) and Amount.
I need to total the Income and Expenditure for every Vote separately like in :
SELECT
Votes.VoteName,
Sum(Income) as TotalIncome (where transtype=1),
sum(Expenditure) as TotalExpenditure (where TransType=2)
FROM
Votes
INNER JOIN
Transactions
ON
Votes.VoteNumber=Transactions.DebitVoteNumber
and again
INNER JOIN
Transactions on Votes.VoteNumber=Transactions.CreditVoteNumber WHERE
date<=MyDate (a parameter) groupby ??? etc.... ran out of ideas.
Help will be very much appreciated.
Thanks
I have two tables - one called Votes with fields VoteNumber and VoteName - and one called Transactions with the following fields : ID, Transdate, Description, DebitVoteNumber, CreditVoteNumber, Transtype (1 for Income and 2 for Expenditure) and Amount.
I need to total the Income and Expenditure for every Vote separately like in :
SELECT
Votes.VoteName,
Sum(Income) as TotalIncome (where transtype=1),
sum(Expenditure) as TotalExpenditure (where TransType=2)
FROM
Votes
INNER JOIN
Transactions
ON
Votes.VoteNumber=Transactions.DebitVoteNumber
and again
INNER JOIN
Transactions on Votes.VoteNumber=Transactions.CreditVoteNumber WHERE
date<=MyDate (a parameter) groupby ??? etc.... ran out of ideas.
Help will be very much appreciated.
Thanks