发布网友 发布时间:2022-04-07 18:50
共2个回答
懂视网 时间:2022-04-07 23:12
b as( SELECT ( SELECT D .CONTENT_HTML FROM MIC_PAPER_PROBLEMS D WHERE D .tm_id = pm.tm_id ) questionTitle, ( SELECT P .ANSWER_HTML FROM MIC_PAPER_PROBLEMS P WHERE P .TM_ID = pm.tm_id ) rightAns, pm. ID pushId, PM.tm_id questionId, PM.USER_ANSWER yourAnswer FROM MIC_TD_EXERCISE_PUSH_PROBLEM pm, MIC_TD_EXERCISE_USER_PUSH ph WHERE pm.push_id = ph. ID AND ph.USER_ID = ? AND ph.SUBJECT_ID = ? and PM.IS_CORRECT = 2 order by PH.PUSH_TIME,PM.CREATE_TIME ) select rownum seq, b.* from b where b.pushId in (select min(b.pushId) from b group by b.QUESTIONID)这样在oracle将as中的内容查询出来之后,命名为b,然后执行最下面的select查询,其中where条件中的无关子查询是为了保证用户对同一道题的错题只显示一个(比如,题目a,用户答了两次,都答错了,题目表中会记录两条数据,此处只将该题目展示一次即可)。
sql查询结果本身要被使用两次
标签:
热心网友 时间:2022-04-07 20:20
mssql_fetch_array(),是mssql_fetch_row()的扩展版本。除了将数据以数字索引方式储存在数组中之外,还可以将数据作为关联索引储存,用字段名作为键名。