Column addition in query

T

Teofilo Homsany

Hi! I have the following query that I want to build.
I want to have a table to print out different customer names with their
respecting transactions for a determined date range.
I want to add the credits, add the debits and then make the credits - debits
to figure out if the person owns money to the company or not.

How can I do that each time I access the credit or debit record it would
create a variable that would hold the total for each. and then that way I
can add them up.

I know it's kind of confusing but if you don't understand let me know and
I'll try to put it in another way.
I want to add debits and credits and store it into a variable while I'm
running the query.

Thanks much in advance,
Teo
 
B

Bas Cost Budde

I feel you think too much in terms of *how* you want to get at results.
Queries allow us to specify just *what* we want to see.

In your case, use a Totals query. Experiment.
 
R

Rebecca Riordan

Teo,

You don't want to create a variable, actually, you want to create a GroupBy
query. Online help has details and examples, but check back if you need
more help...I'll need to know what your tables look like.

HTH

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top