Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I found the ConcatRelated() function [http://allenbrowne.com/func-concat.html] and it seems to do what I want it to, but I need to feed in two keys rather than just one.

My data looks like:

Chain    Store      Warehouse
Walmart  Tucson     Phoenix
Walmart  Tucson     Flagstaff
Walmart  Phoenix    Phoenix
Bi-Lo    Phoenix    Phoenix
Bi-Lo    Phoenix    Flagstaff

And I need to concatenate based on both the Chain and the Store:

Chain    Store      Warehouses
Walmart  Tucson     Phoenix, Flagstaff
Walmart  Phoenix    Phoenix
Bi-Lo    Phoenix    Phoenix, Flagstaff

Can you help me with the arguments I need to use within the brackets?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
571 views
Welcome To Ask or Share your Answers For Others

1 Answer

You could write it this way:

SELECT Distinct
  tbl.Chain,
  tbl.Store,
  ConcatRelated("Warehouse","tbl","Chain=""" & [Chain] & """ and Store=""" & [Store] & """") AS Warehouses
FROM tbl;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...