Rename two fields and calculate the difference using the new etiqu

S

sverre

Hi

I have the following query:

SELECT 1402 AS ACCOUNT, [YY Saldo 1402].SummaförAMOUNT AS HB, [YY Saldo
1402].ACQ_AV_ACCRUED_INT AS SESAM, [HB]-[SESAM] AS [Diff HB SESAM]
FROM [YY Saldo 1402]
GROUP BY 1402, [YY Saldo 1402].SummaförAMOUNT, [YY Saldo
1402].ACQ_AV_ACCRUED_INT, [HB]-[SESAM];


What I would like to add is to use the function sum for the fields:
1. SummaförAMOUNT (renamed to HB)
2. ACQ_AV_ACCRUED_INT AS SESAM (renamed to SESAM)
3. Diff HB SESAM

When I use the function SUM instead of group by on these fields ACCESS
returns a 3 Boxes and asks me for parameter value for each field.

Can I avoid this and why does Access ask for parameter value?

Many thanks in advance
 
D

Duane Hookom

I always try to avoid re-using an alias in another calculation when creating
queries in Access.

SELECT 1402 AS ACCOUNT, [YY Saldo 1402].SummaförAMOUNT AS HB,
[YY Saldo 1402].ACQ_AV_ACCRUED_INT AS SESAM,
[SummaförAMOUNT]-[ACQ_AV_ACCRUED_INT] AS [Diff HB SESAM]
FROM [YY Saldo 1402]
GROUP BY 1402, [YY Saldo 1402].SummaförAMOUNT,
[YY Saldo 1402].ACQ_AV_ACCRUED_INT,
[SummaförAMOUNT]-[ACQ_AV_ACCRUED_INT];
 

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