我想在access库中抽取5条记录,其中一条是必须的,而其它三条是随机的。
必须的一条也要随机地出现在抽取的记录中。请问如何做?
select top 1 * from table order by rnd(id)
union all
select top 3 * from table order by rnd(id)
select top 1 from table1 where id=12
union all
select top 4 from table1 where id<>12 order by rnd()