This code has always stumped me, I have two training courses I am trying to find records of which employee has taken them, The code is:
SELECT O896IA_VEMPPRSA.EMP_NA, O867IA_VTRAING.SYS_EMP_ID_NR, O867IA_VTRAING.REG_NR,
O867IA_VTRAING.DIS_NR, O867IA_VTRAING.TNG_SYS_NR
FROM O896IA_VEMPPRSA INNER JOIN O867IA_VTRAING ON O896IA_VEMPPRSA.SYS_EMP_ID_NR =
O867IA_VTRAING.SYS_EMP_ID_NR
WHERE (((O896IA_VEMPPRSA.EMP_EMT_STS_CD)<>"T"))
GROUP BY O896IA_VEMPPRSA.EMP_NA, O867IA_VTRAING.SYS_EMP_ID_NR, O867IA_VTRAING.REG_NR,
O867IA_VTRAING.DIS_NR, O867IA_VTRAING.TNG_SYS_NR;
I need to find the TNG_SYS_NR 1095 or 1743. If they have the record then I need a Y and if not I need it to show N.
I need it to show Name, ID, Reg, Dis, 1095 Y or N, 1743 Y or N. So if they took both courses I need just one row with all their data and Y for 1743 & for 1095. Right now it shows an employee listed twice with Y for 1095 N 1743 and N for 1095 Y 1743 if they took both.
+-----------------------------------+--------------------------------+--------+--------+------+------+
| EMP_NA | SYS_EMP_ID_NR | REG_NR | DIS_NR | 1095 | 1743 |
+-----------------------------------+--------------------------------+--------+--------+------+------+
| AMOS, SHARNELE | 1531218 | 20 | 10 | N | Y |
| AMOS, SHARNELE | 1531218 | 20 | 10 | Y | N |
| ANDERSON JERNAGIN, SHERRY | 0354362 | 25 | 80 | N | Y |
| ANDERSON JERNAGIN, SHERRY | 0354362 | 25 | 80 | Y | N |
| BAILEY, EDWARD | 0070433 | 20 | 10 | N | Y |
| BAILEY, EDWARD | 0070433 | 20 | 10 | Y | N |
+-----------------------------------+--------------------------------+--------+--------+------+------+