解决方案 »
- 一个select要求其中的某个字段必须在另一个select中存在怎么写sql?
- 急!DataGuard 里面,主数据库加了8个2G的数据文件,现在新加的数据文件去不了从库,但是日志还在同步
- oracle 9i exp imp的数据转移问题
- 郁闷的问题。两个表共用一序列带来的问题
- 动态sql语句问题
- 谁有10204_vista_w2k8_x64_production_client.zip?
- oracle 导入时候 1017错误是什么问题啊??????????
- 恢复数据库不成功,造成登录管理服务器不成功,但能独立启动,这事什么原因?
- MSSQL的语句charindex(':', filename)-1在Oracle中如何实现,谢谢?
- 哪位大牛有Mac版的orlace数据库?急!
- 100分求一个数据库查询语句(ORACLE 11g)
- 如何判断字段时间,精确到时分秒
那么字段下abc是字段名还是b表中 name的值
code字段是干啥用的,排序用吗?
select 'select * from b where code '||decode(max(operator),'=','in','!=','not in')||' ('||wmsys.wm_concat(code)||')'
from a where name='abc'
a and b or c和a and c or b这结果能一样吗?
另外比如有3个条件,只需要有两个logic用于关联,多出来的是哪个,怎么判断?
-- 11.2 下,你可以试试 listagg 函数。
create table m as
select 'cc' name , 'and' logic , '=' op ,'555' as code from dual union all
select 'cc' name , 'and' logic , '=' op ,'444' as code from dual union all
select 'name' name , 'and' logic , '=' op ,'100' as code from dual union all
select 'name' name , 'and' logic , '=' op ,'101' as code from dual union all
select 'name' name , 'and' logic , '=' op ,'111' as code from dualwith mt as (
select listagg(' ' || name || op || code || ' ' || logic ,'') within group (order by name) c
from m where name = 'name'
)
select substr(c,1,length(c) -4 ) from mt
select '('||listagg('code'||operator||code,' or ') within group(order by rownum)||')' str
from a where name='abc' and logic='or'
union all
select 'code'||operator||code str
from a where name='abc' and logic='and'
)