如何从mysql表中获取随机且有限的多个结果?
表名:
questions
它有几列:
id | question | choice | second_choice | category
1 | some txt | a | b | sport
2 | some txt | c | e | sport
3 | some txt | c | e | sport
4 | some txt | a | b | job
5 | some txt | y | w | job
6 | some txt | y | w | job
7 | some txt | l | c | hobby
8 | some txt | p | o | hobby
9 | some txt | p | o | hobby
我想从每个类别中获得2个问题,当然也是随机的。 所以我将在所有6个问题中得到所有问题,并且每个类别都有2-2-2个
是否可以在codeigniter中执行此操作? 如果是的话请帮助我。感谢