SHOW:
|
|
- or go back to the newest paste.
1 | - | SELECT |
1 | + | SELECT |
2 | - | l1.LAB_NAME AS LAB, |
2 | + | l.LAB_NAME, |
3 | - | l2.LAB_NAME AS BOSS, |
3 | + | l.SALARY, |
4 | - | l1.SALARY AS LAB_SALATY, |
4 | + | d.DEP_NAME |
5 | - | l2.SALARY AS BOSS_SALATY |
5 | + | |
6 | LABORING l, | |
7 | - | LABORING l1, |
7 | + | DEPARTAMENT d, |
8 | - | LABORING l2 |
8 | + | |
9 | - | WHERE l1.LAB_BOSS_ID = l2.LAB_ID |
9 | + | (SELECT |
10 | - | AND l1.SALARY > l2.SALARY |
10 | + | d.DEP_ID, |
11 | MAX(l.SALARY) AS SALARY_MAX | |
12 | FROM | |
13 | LABORING l, | |
14 | DEPARTAMENT d | |
15 | WHERE l.DEP_ID = d.DEP_ID | |
16 | GROUP BY l.DEP_ID) sq | |
17 | ||
18 | WHERE l.DEP_ID = sq.DEP_ID | |
19 | AND l.SALARY = sq.SALARY_MAX | |
20 | AND d.DEP_ID = sq.DEP_ID |