Can someone explain me how to program phases?

For example, the same npc can be in more than 1 phaseID at the same xyzo position. How can I use one db row to do that? Or do I MUST use more than one row?

I am working on 7.x

Ok I read https://github.com/TrinityCore/TrinityCore/issues/12715

But I still don’t understand how to generate the phaseGroup… In that example is said phase group is 368… but what is the mathematical calculation?