postgresql随机查询一条数据

随机获取一条数据,使用random()函数,也可以加筛选条件:

select id from table where status = 0 order by random() limit 1 ;

你可能感兴趣的:(数据库,postgresql)