|
-
1. Use union all:
select emp_no,max(lut) from (
select emp_no,lut from emp1
union all
select emp_no,lut from emp2
)
group by emp_no;
2. Use max in the inline view:
select emp_no,max(lut) from (
select emp_no,max(lut) lut from emp1
group by emp_no
union all
select emp_no,max(lut) lut from emp2
group by emp_no
)
group by emp_no;
3. Use a join:
select emp_no,greatest(max1,max2)
from (
select e1.emp_no, max(e1.lut) max1, max(e2.lut) max2
from emp1 e1 join emp2 e2 on (e1.emp_no = e2.emp_no)
group by e1.emp_no
)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|