cprobertson1
Registered User.
- Local time
- Today, 12:27
- Joined
- Nov 12, 2014
- Messages
- 36
I have recently had an issue grouping with a memo field and removing something other extraneous data - but today the specificaiton has changed! (Again(after spending most of last week working on that problem)) - and now I need to add the contract number that corresponds to each rejection...
Outstanding!
I've given an idea below of what I need to happen: tbl1 [GROUPED] is the result of the previous GROUP BY clause - tbl2 [RAW] is one of the tables used in teh GROUP BY clause - and tbl3 is what I need as an output.
As you can see, I need to concatenate all instances of column C from tbl2, based on a matching columns A AND B from tbl1 and tbl2
tbl1 [GROUPED]
tbl2 [RAW]
tbl3 [grouped + concatenated RAW]
I'm not entirely sure how to approach the problem - what I think I need to do, is a SELECT subquery that matches up and groups any instances of columns A and B, with C not being grouped - and then carrying out the concatenation (which is the problematic part) and finally join all that to the existing query.
I believe Allen Browne's ConcatRelated function may be key here, but I can't figure out how to integrate it into the group-by function - it'd be fine where I manually searching for a given PO or part number, but I need to carried out on all of them!
Any suggestions?
Many thanks in anticipation!
Outstanding!
I've given an idea below of what I need to happen: tbl1 [GROUPED] is the result of the previous GROUP BY clause - tbl2 [RAW] is one of the tables used in teh GROUP BY clause - and tbl3 is what I need as an output.
As you can see, I need to concatenate all instances of column C from tbl2, based on a matching columns A AND B from tbl1 and tbl2
tbl1 [GROUPED]
Code:
col_A col_B col_C col_D col_E col_...n
A 1 doc1 reason excuse
A 1 doc2 reason excuse
A 1 doc3 reason excuse
B 1 doc reason excuse
B 2 doc reason excuse
B 3 doc reason excuse
C 1 doc reason excuse
D 1 doc reason excuse
E 1 doc reason excuse
tbl2 [RAW]
Code:
col_A col_B col_C col_...n
A 1 111
A 1 222
A 1 333
B 1 444
B 2 555
B 3 666
C 1 777
D 1 888
E 1 999
tbl3 [grouped + concatenated RAW]
Code:
col_CONCAT col_A col_B col_C col_D col_E col_...n
111,222,333 A 1 doc1 reason excuse
111,222,333 A 1 doc2 reason excuse
111,222,333 A 1 doc3 reason excuse
444 B 1 doc reason excuse
555 B 2 doc reason excuse
666 B 3 doc reason excuse
777 C 1 doc reason excuse
888 D 1 doc reason excuse
999 E 1 doc reason excuse
I'm not entirely sure how to approach the problem - what I think I need to do, is a SELECT subquery that matches up and groups any instances of columns A and B, with C not being grouped - and then carrying out the concatenation (which is the problematic part) and finally join all that to the existing query.
I believe Allen Browne's ConcatRelated function may be key here, but I can't figure out how to integrate it into the group-by function - it'd be fine where I manually searching for a given PO or part number, but I need to carried out on all of them!
Any suggestions?
Many thanks in anticipation!
Last edited: