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

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -