I add 2 banners to the database, they have 0 views each. They are displayed now by 1, sorted by views

ORDER BY `shows` ASC LIMIT 1 

Conclusion of the 1st banner - 1 view adds

Everything works fine, but if I add another banner, it will have 0 views, and it will constantly show until it has the same number of views as the brothers.

That's actually the question, how to deduce them, by what criterion to sort, what would they be displayed alternately?

    1 answer 1

    add at the end of the query ORDER BY RAND() - the query will select records for the rendezvous

    • I would sort by shows * RAND () - German Borisov
    • and how will it be better? - user206303
    • By the fact that each time the request returns a different record to you, well, the truth is not alternately but randomly (by appointment) - Ivan Turcan