MySql 隨機排序輸出 ~ ORDER BY RAND()

如果想隨機排序輸出某某資料~~~~~

就用 ORDER BY RAND()

SELECT * FROM products WHERE category_id = '3' ORDER BY RAND() LIMIT 3

這樣就是隨機輸出~~~~3個

沒有留言: