Home > database >  Rank () over (partition by written into a mysql
Rank () over (partition by written into a mysql

Time:09-26

CodePudding user response:

The select t.i d, t.j ob_id, t.F INALWRITTENSCORE, rank () over (partition by t.j ob_id order by t.F INALWRITTENSCORE desc) rank
The from t_exam t, t_job_information j
Where
- t.p lan_id=# {planId}
- and
T.p aymentstatus=1 and tc ANCLEMARK=1
And t.j ob_id=j.i d
This is the oracle way

CodePudding user response:

Mysql, try this:
 
The select, Anderson d a.f inalwrittenscore, (@ JOB_ID:=a. ob_id) JOB_ID
IF (@ JOB_ID=a. ob_id, @ rank:=@ rank + 1, @ rank:=1) AS rank
A, the from t_exam t_job_information b, (select @ rank:=0, @ JOB_ID:=NULL) c
Where t.p aymentstatus=1
And tc anclemark=1
And t.j ob_id=j.i d
The order by a. ob_id, a.f inalwrittenscore desc
  • Related