I have data like this:
Table ExistingBinData:
VariantName|Bin
XYZ|QTY. 5 @ SHELF 3
XYZ|QTY. 1 @ SHELF 2
XYZ|QTY. 1 @ SHELF 17
ABC|QTY. 3 @ SHELF 13
ABC|QTY. 2 @ SHELF 12
I used Allen Browne's Concat Related function found here: http://allenbrowne.com/func-concat.html to get the below result:
Code:SELECT ExistingBinData.VariantName, ConcatRelated("Bin","ExistingBinData","[VariantName] = """ & [VariantName] & """") AS Bins FROM ExistingBinData ORDER BY ExistingBinData.VariantName;
Query ExistingBinsUngrouped:
VariantName|Bins
XYZ|QTY. 5 @ SHELF 3, QTY. 5 @ SHELF 3, QTY. 1 @ SHELF 17
XYZ|QTY. 5 @ SHELF 3, QTY. 5 @ SHELF 3, QTY. 1 @ SHELF 17
XYZ|QTY. 5 @ SHELF 3, QTY. 5 @ SHELF 3, QTY. 1 @ SHELF 17
ABC|QTY. 3 @ SHELF 13, QTY. 2 @ SHELF 12
ABC|QTY. 3 @ SHELF 13, QTY. 2 @ SHELF 12
The above query takes just a couple seconds to run. My problem is that I need to Group By VariantName but the moment I do so, whether adding Group By within the query above, or by creating another query to query the query above and using Group By there and either way makes the query take about 15 minutes to run to Group 15k records down to 10k. Any Ideas on how to speed it up?