Select Random record and update one record in one query?

I am working on a small rotary banner script that loads a random banner from a database. I am tracking impressions in the database and would like to know if I can select a random record and update its display value in a single query, or I will need to select a random record and then update based on the pk record. Using MySQL.

+3
source share
1 answer

This cannot be done in a single request. It is best to put this logic in a stored procedure.

+3
source

Source: https://habr.com/ru/post/1714617/


All Articles