這個(gè)一個(gè)簡(jiǎn)單的考試系統(tǒng) 先上sql語(yǔ)句:select * FROM (select * from singleproblem where type='1' and testid='1' order by dbms_random.value ) where rownum <= 5 union all select * FROM (select * from singleproblem where type='2' and testid='1' order by dbms_random.value ) where rownum <= 1 union all select * FROM (select * from singleproblem where type='3' and testid='1' order by dbms_random.value ) where rownum <= 1我做出來(lái)隨機(jī)了,但是因?yàn)槭怯玫倪@個(gè) union all 連接的,所以題目老是先出來(lái)單選題,然后復(fù)選題,最后才判斷題這3大題里面的題目倒是隨機(jī)抽的。就是這個(gè)順序好像被union all給套住了。誰(shuí)在前面他就先隨機(jī)哪一類(lèi)題目關(guān)于sql語(yǔ)句字段意思就不用我解釋了吧 基本明眼人一看就懂 麻煩大家給個(gè)解決方案
一道關(guān)于sql語(yǔ)句的問(wèn)題 求真相...
小怪獸愛(ài)吃肉
2018-08-21 05:06:14