怎样将查询出来的结果作为另一个查询的条件
例如:
将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 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' 这样的
解决方案 »
- oracle sql如何实现 nvarchar2字段类型转换,计算时间
- DML触发器中如何中止DML操作?
- oracle report plsql问题
- 怎么样将oracle8i的数据复制到sql2000中,不能使用dts
- 有一个30g的Oracle数据库dmp备份,有什么简单打开方法
- 异构数据库问题(SQL SERVER)出错
- 大家来帮我看看怎么提高这个存储过程的效率,分不够可以再加!!!!在线等!!!!急!!!!
- 虚心求教,望指点一二
- pl/sql 存储过程问题 不能insert
- oracle8.1.7的数据库备份文件怎样恢复到oracle8i上 ?
- 聚集函数里case的改变
- 一个关于duel的不解,求解释
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'
select distinct substr(filter,4) from t_Wage_Status where companyid = '43f00833-586d-4f53-81c7-1e10f528ca9c' and year = 2012 and month = 10 查出来的结果
CompanyID='43f00833-586d-4f53-81c7-1e10f528ca9c' AND EMPLOYEETYPE='1' AND TYPE<>'8'
放到where的后面是可以查到数据的
||' and 1' = '1'可不可以理解为1等于"1",因为不等,所以没数据呀
额好像是的,你可以在 ||' and 1' = '1' 中把第一个1中加上单引号的转义字符,应该就可以了给分啊,lZ。。
我把它改成这样
select * from t_wage_personnel where '1'='1' || (select distinct filter from t_Wage_Status where companyid = '43f00833-586d-4f53-81c7-1e10f528ca9c' and year = 2012 and month = 10)一样查不出数据
额...'1'='1' || 缺一个 and 符号
你上面那样写 意思是把 '1' 和 '1' || (select distinct filter from t_Wage_Status where companyid = '43f00833-586d-4f53-81c7-1e10f528ca9c' and year = 2012 and month = 10 这个拼接的字符串比较,肯定是比较false的..