shuffle random MYSQL results

前端 未结 4 422
广开言路
广开言路 2020-12-11 05:27

The following code displays random database images as well as one specific image (which is what I want). How can I shuffle these results after database query as image ID 11

4条回答
  •  时光说笑
    2020-12-11 06:27

    Its doesnt need to be that complicated if you just put for example

    SELECT * FROM tbl_table ORDER BY RAND()
    

    This will randomise your data. if you want to limit out how many images you show then just put:

    SELECT * FROM tbl_table ORDER BY RAND() LIMIT 6
    

提交回复
热议问题