sql - How should I write query for this? -


i have table columns employee_id, effective_date, salary. ie each employee, have multiple records based on when salary got changed. want print each employee salary latest effective_date. how this?

select employee_id, effective_date, salary employees t not exists     (select 1 employees tt tt.employee_id = t.employee_id , tt.effective_date > t.effective_date) 

this may work?


Comments

Popular posts from this blog

html - jquery - p element wont show after I hid it -

python - BeautifulSoup: How to get the nearest tag -

php - Return Last Insert ID with PDO -