Paging in SQL with LIMIT/OFFSET sometimes results in duplicates on different pages

后端 未结 3 979
面向向阳花
面向向阳花 2021-02-13 10:31

I\'m developing an online gallery with voting and have a separate table for pictures and votes (for every vote I\'m storing the ID of the picture and the ID of the voter). The t

3条回答
  •  感动是毒
    2021-02-13 11:24

    The simples explanation is that you had some data added or some votes occured when you was looking at different pages.

    I am sure if you would sorte by ID or creation_date this issue would go away.

    I.e. there is no issue with your code

提交回复
热议问题