uj5u.com熱心網友回復:
select t.id, t.job_id,t.FINALWRITTENSCORE, rank() over(partition by t.job_id order by t.finalwrittenscore desc) rankfrom 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的寫法
uj5u.com熱心網友回復:
mysql的話,試試這個:
select a.id,a.finalwrittenscore, (@JOB_ID := a.job_id) job_id
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.canclemark= 1
and t.job_id = j.id
order by a.job_id, a.finalwrittenscore desc
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/77959.html
標籤:開發
