SQL连接两个表的一行很不常见 [英] Sql join for two tables for one row which is uncommon
问题描述
我有两个表,一个是Employeebill表,另一个是EmployeePay表,在Employeebill表中有两行分别表示8月和9月的薪水,而在Employeepay表中有一行针对9月的薪水(这是预付款) .现在,我想在我的水晶报表中显示应付工资.注意:9月份的薪水已预付.因此应支付的薪水将来自Employeebill表中的8月份薪水.但是,当我进行内部联接时,我获得了9月薪水的一排,而当我进行外部联接时,我获得了9月和8月薪水的两排,但是我只想显示8月工资的一排.
有谁能在这方面提供帮助.我将永远感激不尽.
问候
莎·诺曼
软件工程师.
Callsnit Inc.
I have two tables, one is Employeebill table, another is EmployeePay table, in Employeebill table has two rows for the month of August and September Salary, and in Employeepay table has one rows for the September salary(that was as advance). Now I want to show in my crystal report for the payable salary. note: September salary has paid as advance. So payable salary will be from Employeebill table for August salary. But when I make inner join I got for one rows with september salary, and when I make outer join I got for two rows with september and August Salary, But I want to show only one rows for August salary.
Have anyone able to help in this regards. I will gratefull for ever.
Regards
Shah Noman
Software Engineer.
Callsnit Inc.
推荐答案
SELECT TableA.TableAId, TableA.Name
FROM TableA INNER JOIN TableB ON TableA.TableAId <> TableB.TableBId
这将为您提供帮助.
This will help you.
这篇关于SQL连接两个表的一行很不常见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!