select t.id, t.job_id,t.FINALWRITTENSCORE, rank() over(partition by t.job_id order by t.finalwrittenscore desc) rank
from t_exam t, t_job_information j
where
-- t.plan_id = #{planId}
-- and
t.paymentstatus = 1 and t.CANCLEMARK= 1
and t.job_id = j.id
这是oracle的写法
from t_exam t, t_job_information j
where
-- t.plan_id = #{planId}
-- and
t.paymentstatus = 1 and t.CANCLEMARK= 1
and t.job_id = j.id
这是oracle的写法
IF( @JOB_ID = a.job_id,@rank := @rank + 1,@rank :=1 ) AS rank
from t_exam a, t_job_information b, (select @rank :=0,@JOB_ID := NULL ) c
where t.paymentstatus = 1
and t.cancle= 1
and t.job_id = j.id
order by a.job_id, a.finalwrittenscore desc