表1
我们将ID作为主键,他自己的工资
ID | 名称 | 薪金 |
---|
1 | “ x” | 500 |
2 | “ y” | 1000 |
3 | “ z” | 1500 |
表2
我们从付款系统
ID | 日期 | 薪金 |
---|
1 | “ 6/22/2020” | 500 |
2 | “ 6/25/2020” | 1000 |
3 | <代码>“ 8/05/2021” | 1500 |
我希望查询表2中的项目与表1进行比较,我的目标是确保每个员工在表1
示例
中的员工“ 1” 中获得确切的薪水薪水500在一个月的时间里,他只收到300个要检索员工
*优先:计算他的就业时间中他没有得到确切的薪水并计算有多大差异$
*注意:员工可能会得到 多少差异。支付比他的薪水更少或更高
Table 1
where we have ID as primary key and his own salary
ID | Name | Salary |
---|
1 | " X " | 500 |
2 | " Y " | 1000 |
3 | " Z " | 1500 |
table 2
where we have data from the payment system
ID | Date | Salary |
---|
1 | " 6/22/2020 " | 500 |
2 | " 6/25/2020 " | 1000 |
3 | " 8/05/2021 " | 1500 |
i want a query to compare items from table 2 with table 1 where my goal is to make sure every employee gets his exact salary paid as it in table 1
example
employee "1" with salary 500 let say on a month he received only 300 want to retrieve employee
* preferred : calculate how many months out of his employment time where he didn't get his exact salary and calculate how much difference $
* Note : the employee might get paid less or more than his salary
发布评论
评论(2)
这样的事情应该做到这一点:
Something like this should do it:
在
ID
上加入表,然后将差异放入子句中。示例数据(您拥有它&amp;您不必输入):
查询从这里开始:
Join tables on
ID
and put the difference into thewhere
clause.Sample data (you have it & you don't have to type that):
Query begins here: