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

java - How to print docx and pdf? -

qml - Is it possible to implement SystemTrayIcon functionality in Qt Quick application -

java - IntelliJ to move a class along with conflicted classes to a new package? -