Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

How to create a list of Item Locations from a list of Locations

$
0
0

I have a table something like this:

Location  Item       Count
--------- ---------- ------
19        050-05     1
20        050-05     1
3         050-19     72
12        050-19     72
77        050-19     56
90        050-19     24
7         050-21     96
13        050-21     64
24        050-21     96
9         050-27     96
15        050-27     96
116       050-27     64
156       050-27     96
184       050-27     64
57        056-05     1
71        085-07     90
88        085-07     90
135       085-07     18

I am having trouble coming up with the SQL to convert it to something like this:

Item     Total Locations
-------- ----- ------------
050-05   2     19, 20
050-19   224   3, 12, 77, 90
050-21   256   7, 13, 24
050-27   416   9, 15, 116, 156, 184
056-05   1     57
085-07   198   88, 135


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>