I have a table which looks like that:
id: primary key content: varchar weight: int
What I want to do is randomly select one row from this t
Maybe this one:
SELECT * FROM T JOIN (SELECT FLOOR(MAX(ID)*RAND()) AS ID FROM ) AS x ON T.ID >= x.ID LIMIT 1; Or this one: SELECT * FROM tablename WHERE somefield='something' ORDER BY RAND() LIMIT 1 0 讨论(0) 查看其它7个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
Or this one:
SELECT * FROM tablename WHERE somefield='something' ORDER BY RAND() LIMIT 1