Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GRoup BY in Report Writer

Status
Not open for further replies.

jpb

Programmer
Mar 31, 2001
17
IE
I am trying to print a profit and loss report using report writer....I have a table in my database which stores all the account details...name, balance type etc...

I want to display this on the report as follows...

Account Name (income) Balance
.
.
Total Income Income subtotal Total


Account Name(Expenses) Balance
.
.
Total Expenses Total Subtotal


Net PRofit Loss Total Incom-expenses


I thought I would be able o do it using a group by clause in an sql statemenet...as follows

"Select AccountName, AccountBalance,sum(AccountBAlance),AccountType from Accounts Group by Account Type

Any suggestions how I could achieve this
 
Whe you're using aggregate functions (sum, count,etc.. )anything not contained in an aggregate within the Select clause must be referenced in the Group by clause.

Try:

SELECT AccountName, AccountBalance,
sum(AccountBAlance),AccountType
FROM Accounts
Group by AccountType, AccountName, AccountBalance




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top