Combine two integers to create a unique number

后端 未结 7 2067
北荒
北荒 2020-12-10 02:05

Good Morning,

I was looking for a way to combine two integers to create a unique number, I have two tables that I need to combine into a third table with unique numb

7条回答
  •  萌比男神i
    2020-12-10 02:20

    combinedid = classid*1000 + schoolid
    

    And then, later:

    classid = combinedid / 1000 // Integer division
    schoolid = combinedid % 1000
    

提交回复
热议问题