views:

172

answers:

1

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

+2  A: 

This cannot be done in a single query. Your best bet is to put this logic in a stored procedure.

John Rasch
I suspected that. Thanks.
Jonathan Sampson