Reputation: 633
I have some data that relates to some production inputs and outputs. What I want to do is, for each production run, show what went in and what came out.
I have, at this point, something that looks like this:
Run# Item Input Output
1 X 1
Y 1
2 A 2
B 3 2
C 3
Where Input/Output is derived from a 'direction' column group, and there are row groups on Run# and Item. What I want is something like this:
Run# Item Input Item Output
1 X 1 Y 1
2 A 2 B 2
B 3 C 3
Is this even possible? I feel like it should be, but as you can probably see from the title, I don't even know what to begin searching.
Upvotes: 0
Views: 148
Reputation: 633
The way to do this is to add a rank() over the query like so:
dense_rank() OVER (Run#, Direction Order By ItemCode) as rank
You can then perform a row grouping by the rank
field (you don't have to display the column), and add ItemCode
as a column in the column grouping.
Upvotes: 1