combine multiple records in a single

r621

New member
Local time
Today, 04:57
Joined
Dec 18, 2020
Messages
24
Dears , I need one time again your help, I've a table as following:

TAGNoINSTRUMENT TYPESh
99-PP-3001ALARM33
99-PP-3002ALARM33
99-PP-3003ALARM33
99-PP-3004ALARM33
99-PP-3005ALARM33
99-PP-3006ALARM33
99-PP-3007ALARM33
99-PP-3008ALARM33

I need to combine all the records in a single record. I've tried with INNER JOIN but is not working as I want, the common point for all records is the column Sh value 33 which is my sheet number :
Basically I've to combine all records as following (just a sample I've not reported all records)

99-PP-3002ALARM3399-PP-3003ALARM3399-PP-3004ALARM33

Could you please help me
 
Would a pivot table with column numbers 1-n be possible?

like:
Code:
TRANSFORM Max(TAGNo) AS MaxTAGNo
SELECT
     sh, [INSTRUMENT TYPE]
FROM (
      SELECT
             TagNo, [INSTRUMENT TYPE], sh,
             DCount("*","YourTable","sh = " & [sh] & " and TagNo <= '" & [TagNo] & "'") AS N
      FROM
            YourTable
   )  AS Q
GROUP BY sh, [INSTRUMENT TYPE]
PIVOT N
 
Last edited:
What's the big picture? What will your data in this format allow you to achieve? Perhaps there is a better way to achieve that end goal.
 
Hello Plog, I shall have a single record because I need to import that format in program for automatic drawing
 
theDBGuy provided the simplest record concatenation code I've seen. If you want another example, review http://allenbrowne.com/func-concat.html

However, seems to me the output should not repeat ALARM and 33 values. Why not showing TAG_No 99-PP-3001?
 

Users who are viewing this thread

Back
Top Bottom