Ask Your Question

Reorganizing the primary key numbering sequence. Any way to do that?

asked 2015-04-11 03:00:19 +0200

mrmister gravatar image

updated 2015-04-11 03:12:36 +0200


I'm using the UNION statement to fusion two different tables into a single table, and the problem is I am getting a mess in my ID (primary key), so I find many registries showing the same number 1,1,1,1,2,2,2,3,3,4,4,4,4,4,4,5,5... and so on...

I'm wondering if do we have any way or method...? perhaps a SQL code... that make a miracle and reorder from 1 to the latest registry, all the registries in the right sequence, 1,2,3,4,5,etc. avoiding duplicate numbers in the primary key. Any way to solve this?

Any SQL code or method to make the miracle would be greatly appreciated


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-04-11 07:38:42 +0200

pierre-yves samyn gravatar image

Hi - This FAQ explains the different scenarios


edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-04-11 03:00:19 +0200

Seen: 98 times

Last updated: Apr 11 '15