0

if I have a table like this:

MatchCode TransferId
17edce4d 7
17edce4d 17
20332cf0 22
20332cf0 30

is it possible make the result return this?

MatchCode TransferId1 TransferId2
17edce4d 7 17
20332cf0 22 30
Anonymous
  • 835
  • 1
  • 5
  • 21
AFetter
  • 3,355
  • 6
  • 38
  • 62

1 Answers1

1

If each MatchCode group will always have only two records, then you can use the MIN and MAX along with a GROUP BY:

SELECT MatchCode, MIN(TransferId) AS TransferId1, MAX(TransferId) AS TransferId2
FROM yourTable
GROUP BY MatchCode
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360