I have a query to get JobRanking based on yearleftpost to get latest job followed by previous jobs worked.
select
c.id,
c.Fname,
cfe.JobYear,
cfe.YearLeftPost,
cfe.Iscurrentjob,
ROW_NUMBER() OVER (Partition by c.id ORDER BY Iscurrentjob DESC, yearleftpost DESC) AS JobRanking
from
candidates c
left join Candidate_FunctionalExperience cfe on c.id = cfe.CandidateID
It gives me the result:
id Fname JobYear YearLeftPost Iscurrentjob JobRanking
EC2 sdsadsa 1430 1433 1 1
EC2 sdsadsa 1429 1430 0 2
EC2 sdsadsa 1424 1428 0 3
EC2 sdsadsa 1428 1428 0 4
EC2 sdsadsa 1424 1426 0 5
Now, I have a IscurrentJob (Boolean value) 0 or 1, I am not getting the correct order of JobRanking.