MYSQLはランダムに1本のデータを取り出します
962 ワード
- SELECT MIN(id), MAX(id) FROM tablename;
-
- Fetch the result into $a
-
- $id=rand($a[0],$a[1]);
-
- SELECT * FROM tablename WHERE id>='$id' LIMIT 1