What is the best way to do this in Access?
Create table tmp ( plant int, material vchar(20), workcenter int, setuptime vchar(20) ) insert into tmp values( 1, mat1, 2, 30) insert into tmp values( 1, mat1, 3, 30) insert into tmp values( 1, mat2, 3, 30) insert into tmp values( 1, mat2, 4, 30) insert into tmp values( 2, mat1, 4, 30) insert into tmp values( 2, mat1, 5, 30) Result needs to look like.
Plant Material Workcenter1 Setuptime1 Workcenter2 Setuptime2 1 Mat1 2 30 3 30 1 Mat2 3 30 4 30 2 Mat1 4 30 5 30 I was thinking that this might work, but there has to be a better way.
SELECT t.Plant, t.Material, t.Workcenter as Workcenter1, t.setuptime as SetupTime1 t2.Workcenter as Workcenter2, t2.setuptime as SetupTime2 FROM tmp t LEFT JOIN tmp t2 on t.plant = t2.plant and t.material = t2.material Thanks a bunch.