Forum Moderators: coopster
SELECT MIN(age) AS min, MAX(age) AS max FROM table;
;)
For example, I want to display some in-house ADs base on impressions, three step2:
1. SELECT id FROM tab ORDER BY impression ASC LIMIT 0, 2;
(Get two ADs with minimum impressions)
2. $id1=id of AD1, $id2=id of AD2
3. UPDATE tab SET impressoion=impression+1 WHERE id=$id1 or id=$id2 LIMIT 2
According to mysql doc, I should create an index on impression column, but it will make the UPDATE step too slow. Any alternate method?