示例:
表:一 列(PK):employee_ssn 列:employee_active位
表:两个 专栏(pk):日期 列(FK):employee_ssn 专栏:total_income 列:total_expenses-
从表二中选择数据:
在此示例中,如何为“employee_active”选择“1”的所有员工?
答案 0 :(得分:1)
你需要JOIN你的桌子。
SELECT two.employee_ssn, two.total_income, two.Total_Expenses
FROM Two
INNER JOIN One
ON one.Employee_ssn = two.Employee_ssn
WHERE One.employee_active = 1;
关于加入的更多链接
答案 1 :(得分:0)
试试这个!!
select * from table1 a inner join table2 b
on a.employee_ssn=b.employee_SSN
where a.employee_active =1