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

Concatenate Fields in MS Query

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hello

I'm using Excel 2003.

I am trying to concatenate fields in MS-Query and it isn't working. Below is the code I have with the DxGrp and DxName in separate columns but I wish to concatenate in one field:

Code:
SELECT `ChartList$`.DxGrp, `DxGrpNames$`.DxGrpName, Sum(`ChartList$`.death) AS 'Deaths', Sum(`ChartList$`.Prob) AS 'ProbDeath'
FROM {oj `ChartList$` `ChartList$` LEFT OUTER JOIN `DxGrpNames$` `DxGrpNames$` ON `ChartList$`.DxGrp = `DxGrpNames$`.diag_flag}
GROUP BY `ChartList$`.DxGrp, `DxGrpNames$`.DxGrpName

Note that the "external data source" is actually a worksheet in the same workbook.

Thanks very much.
 
What about changing this:
SELECT `ChartList$`.DxGrp, `DxGrpNames$`.DxGrpName
to this ?
SELECT `ChartList$`.DxGrp & `DxGrpNames$`.DxGrpName AS Grp

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 


BTW, I often modify my SQL code to make it more readable...
Code:
SELECT
  CL.DxGrp&GN.DxGrpName AS Grp
, Sum(CL.death) AS 'Deaths'
, Sum(CL.Prob)  AS 'ProbDeath'

FROM {oj 
  `ChartList$`  CL LEFT OUTER JOIN 
  `DxGrpNames$` GN 
     ON CL.DxGrp = GN.diag_flag}

GROUP BY
  CL.DxGrp&GN.DxGrpName

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top