0

is it possible to concatenate fields in my query using sql access(querying using excel).

My current query is :

 Select *
 FROM [table$]

But how do I add a new field which concatenates colA&"|"&colB&"|"&colC&"|"&colD

Thanks.

1 Answer 1

2

You seem to understand the expression; just add it to the select:

select t.*, (t.colA & "|" & t.colB & "|" & t.colC & "|" & t.colD) as new_field
from [table$] as t;
Sign up to request clarification or add additional context in comments.

4 Comments

or you could use dynamic sql, but potato puhtahtoe
Thanks! worked, but seemed like i needed to put colA in [] like [colA] , also can I add a where query to query this new field?
@excelguy. . . You can add filtering in a where clause. But new_field is not available unless you use a subquery.
@GordonLinoff , would you be able to help me with this? Having trouble, stackoverflow.com/questions/50683970/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.