shuffle random MYSQL results

前端 未结 4 451
广开言路
广开言路 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:21

    First select the image with ID 11 and than query the rest with UNION keyword

    SELECT *
    FROM Images
    Where ID = 11
    UNION
    SELECT *
    FROM Images
    WHERE ID != 11
    

提交回复
热议问题