我有三个表typemaster,salaryaddition,salarydeduction
打字员表
类型标识 | 类型名 |
1 |Act.Alw |
2 |食堂|
3 |Sht.Alw |
4 |LOP |
加薪表
slno |员工|薪资类型| 金额 |
1 |1 |1 |200 |
工资扣除表
员工 | 工资类型 | 金额 |
1 |2 |500 |
1 | 4 | 300 |
我要显示
员工 | 加法 | 金额 | 扣减 | 数量
1 | Act.Alw |200 | 食堂 | 500 |
1 | 空 | 空 | 洛普 | 300 |
我写查询,但它显示重复的结果
select a.employee,a.typename,a.amount,b.typename,b.amount from
(select employee,typename,amount from salaryaddition
join typemaster on typeid=salaryaddition.salarytype) a,
(select employee,typename,amount from salarydeduction
join typemaster on typeid=salarydeduction.salarytype) b
where a.employee=b.employee