Reputation: 433
I have a table named Employee Which has 3 columns EmployeeID Award Date and Award
| EMPOYEEID | AwardDate | Award
|1 | 10-03-2018| EOY
|1 | 14-08-2018| EBF
|2 | 10-03-2017| EOY
|3 | 10-03-2016| EOY
|2 | 31-12-2017| COINS
|1 | 31-08-2017| COINS
Using SQL query in oracle, What i want is without using analytical function i want to get the first award and last award date for each employee in one scan. Below is and example
ID|LastDate | FirstAward
1|10-03-2018|31-08-2017
2|31-12-2017|10-03-2017
Upvotes: 0
Views: 60
Reputation: 32001
use aggregate function
select EMPOYEEID, max(AwardDate) LastDate, min(AwardDate) FirstAward
from table_name t1
group by EMPOYEEID
Upvotes: 1