我有一个看起来像这样的表(不要问。我没有创建它,但我必须使用它)。让我们称之为奇数表......
Heading Details Issue1 Issue2 Issue3 Comments BatchId
ItemID SN1001 10
Date Done 2018-12-18 10
Section1 1 1 1 10
AreaA 1 1 10
AreaB 10
ItemID SN1002 11
ItemID SN1003 11
ItemID SN1004 11
Date Done 2018-12-11 11
Section1 Test 11
AreaA 1 Stuff 11
AreaB 1 1 Even More 11
ItemID SN1005 12
ItemID SN1006 12
Date Done 2018-12-11 12
Section1 1 12
AreaA 1 1 Blah 12
AreaB 1 Yada 12
希望选择看起来像这样的结果(将每个 ItemID 分成它自己的一组从批次中复制的记录):
Heading Details Issue1 Issue2 Issue3 Comments
ItemID SN1001
Date Done 2018-12-18
Section1 1 1 1
AreaA 1 1
AreaB
ItemID SN1002
Date Done 2018-12-11
Section1 Test
AreaA 1 Stuff
AreaB 1 1 Even More
ItemID SN1003
Date Done 2018-12-11
Section1 Test
AreaA 1 Stuff
AreaB 1 1 Even More
ItemID SN1004
Date Done 2018-12-11
Section1 Test
AreaA 1 Stuff
AreaB 1 1 Even More
ItemID SN1005
Date Done 2018-12-11
Section1 1
AreaA 1 1 Blah
AreaB 1 Yada
ItemID SN1006
Date Done 2018-12-11
Section1 1
AreaA 1 1 Blah
AreaB 1 Yada
注意:结果中不需要 BatchId 列,仅用于区分需要复制数据的组。
非常感谢您的帮助。