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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenation of values??? 1

Status
Not open for further replies.

scottyjohn

Technical User
Nov 5, 2001
523
GB
Hi all,
I have a query with results of another query in column1, columkn2, column3.
I amtrying to add a fourth column4 which sums the first three columns. When I use expression builder, and try to sum them using + it seems to concatenate them into a string rather than add them together? Any help or advice would be good! The actual query is as per below

SELECT QryRPAHTstep2.STARTD, QryRPAHTstep2.[RP Brands], Sum(QryRPAHTstep2.TT) AS SumOfTT, Sum(QryRPAHTstep2.HT) AS SumOfHT, Sum(QryRPAHTstep2.ACWT) AS SumOfACWT, Count(QryRPAHTstep2.EMPID) AS CountOfEMPID, [QryRPAHTstep2]![TT]+[QryRPAHTstep2]![HT]+[QryRPAHTstep2]![ACWT] AS Expr1
FROM QryRPAHTstep2
GROUP BY QryRPAHTstep2.STARTD, QryRPAHTstep2.[RP Brands], [QryRPAHTstep2]![TT]+[QryRPAHTstep2]![HT]+[QryRPAHTstep2]![ACWT];




John
ski_69@hotmail.com
[bigglasses]
 
Something like this ?
SELECT STARTD, [RP Brands], Sum(TT) AS SumOfTT, Sum(HT) AS SumOfHT, Sum(ACWT) AS SumOfACWT, Count(EMPID) AS CountOfEMPID, Sum(TT)+Sum(HT)+Sum(ACWT) AS SumOfTT_HT-ACWT
FROM QryRPAHTstep2
GROUP BY STARTD, [RP Brands];

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Excellent, thank you very much! On a related note, how do you specify results to a certain amount of decimal places?

John
ski_69@hotmail.com
[bigglasses]
 
When in the query design grid select the relevent field and modify the properties sheet.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, I tried that and it didnt happen for me, but I used the round function and all is now well. thanks very much for all the help.

John
ski_69@hotmail.com
[bigglasses]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top