0

I'm creating a left join on two tables and as expected I'm getting multiple entries because the second table might have multiple entries for the unique number in the first column. Instead of having multiple entries I'd like to have one entry and insert all the values that cause them to be multiple into a semicolon separated column.

What i get just now

Record No | Record Title | Tag No |
1000      | Document     | A-100  |
1000      | Document     | B-100  |

what I'd like to achieve

Record No | Record Title | Tag No
1000      | Document     | A-100; B-100

Any help would be appreciated!

SELECT *
FROM [EDMS_ADOC_MAS] as a
LEFT JOIN [DOCUMENT_TAGS] as b ON a.[DOC_NUMBER] = b.[DOC_NUMBER]
WHERE a.LOCN_CD Like "*MDP6*"
jarlh
  • 42,561
  • 8
  • 45
  • 63
Richtea88
  • 111
  • 1
  • 5
  • Tag the dbms you're using (product specific functionality may be handy here.) And show us your current query attempt. – jarlh Jul 11 '17 at 07:43
  • Apologies, I'm using Access – Richtea88 Jul 11 '17 at 07:48
  • you need to concatenate the columns, this should help: https://stackoverflow.com/questions/20403870/concat-equivalent-in-ms-access OR this : https://theaccessbuddy.wordpress.com/2013/08/19/2-handy-concatenation-operators-in-ms-access-operator-types-4-of-5/ – dbajtr Jul 11 '17 at 07:54
  • Thanks for all the help and pointing me in the right direction. In case anyone stumbles across this post I found my solution for this using the VBA code found in the below link. A very easy to use and useful function. Here's the stack overflow question that gave a good example of how to use the function [link](https://stackoverflow.com/questions/13278590/combine-values-from-related-rows-into-a-single-concatenated-string-value) and here's the vba function [link](http://allenbrowne.com/func-concat.html) – Richtea88 Jul 11 '17 at 11:52

0 Answers0