看起来像是mysql
我猜你应该会有个栏目的类型表吧?如果有的话,可以试下这个
select min(ID)
from article a
where lm in ( select * from (select id from 栏目表 b where exists(select * from article where lm=b.ID and biye=-1)
order by rand()
limit 1) b1)
and biye=-1;
select min(lm) from `article` where biye=-1 order by rand() limit 1