oracle数据库
怎样将查询出来的结果作为另一个查询的条件
例如:
将select distinct substr(filter,4) from t_Wage_Status
where companyid = '43f00833-586d-4f53-81c7-1e10f528ca9c'
and year = 2012 and month = 10 (A)
查出来的结果作为select * from t_wage_personnel (B)的条件
问题:
select * from t_wage_personnel
where
(
select distinct substr(filter,4) from t_Wage_Status
where companyid = '43f00833-586d-4f53-81c7-1e10f528ca9c'
and year = 2012 and month = 10
)
为什么不行?求解
补充:A查询出来的结果是
CompanyID='43f00833-586d-4f53-81c7-1e10f528ca9c' AND EMPLOYEETYPE='1' 这样的
------解决方案--------------------你试试这样
select * from t_wage_personnel
where
(
select distinct substr(filter,4) from t_Wage_Status
where companyid = '43f00833-586d-4f53-81c7-1e10f528ca9c'
and year = 2012 and month = 10
)
------解决方案--------------------
' and 1' = '1'