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
Do you execute one query per page to display? If yes, I suspect that the database doesn't guarantee a consitent order for items with the same number of votes. So first query may return { item 1, item 2 }
and a 2nd query may return { item 2, item 1}
if both items have same number of votes. If the items are actually items 10 and 11, then the same item may appear on page 1 and then on page 2.
I had such a problem once. If that's also your case, append an extra clause to the order by to ensure a consistent ordering of items with same vote number, e.g.:
ORDER BY picture.vote, picture.ID