How do I concatenate fields in MSAccess SQL?

  • Thread starter Siegfried Heintze
  • Start date
S

Siegfried Heintze

Can anyone tell me how to make this attached SQL statement work? I'm trying
to concatenate two fields from two different tables using a plus (+) and it
does not work! I also tried CONCAT(CaseTypes.sDescription,
BaseCaseTypes.sDescripton ) but that does not work either!

Thanks,
Siegfried

SELECT CaseTypes.id AS id, CaseTypes.sDescription +
BaseCaseTypes.sDescripton AS sDesc, bDefault FROM CaseTypes, BaseCaseTypes
WHERE bPrivate = 0 AND CaseTypes.ridBaseType = BaseCaseTypes.id ORDER BY
CaseTypes.sDescription
 
D

Duane Hookom

"+" will work some times. The preferred method is using "&" like:
FullName: FirstName & " " & LastName
 
T

Tom Ellison

Dear Siegfried:

I'm not sure why + is not concatenating for you assuming the values
are text. Ampersand (&) works, or is supposed to work, almost the
same, except for how it treats NULLs. Try that, please.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
M

Michel Walsh

Hi,

In MS SQL Server? are you be sure both are strings?

SELECT STR(CaseTypes.sDescription) + STR(BaseCaseTypes.sDescripton) As
sDesc, ...


If you use Jet, try & instead of + .



Hoping it may help,
Vanderghast, Access MVP
 
S

Siegfried Heintze

Thank you. "&" is working. I'm really feeling fustrated that I cannot find
this documented in msdn.microsoft.library.
Can someone point me to a URL where this (and presumably other functions and
operators) are documented?

Thanks,
Siegfried
 

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