SELECT * FROM ( SELECT * FROM ZJZY_BJXXB WHERE TO_NUMBER( TO_CHAR( HAPPENTIME, 'mm' )) = '08' and ISSHOW = '1' and STATUS = '1' ORDER BY dbms_random.value) WHERE ROWNUM < 150
TO_NUMBER( TO_CHAR( HAPPENTIME, 'mm' )) = '08' 这个查询条件 为查询HAPPENTIME 字段中 月份为 08 的数据
dbms_random.value 就是获取随机数
外层嵌套的 select where rownum < 150 为查询前150条数据