现在我有这样的一张表:tbl_sheet_content_field,该表中存放数据如下图:、一个GZ2011041100049就有这么几条,可能还有GZ2011041100050、GZ2011041100051等;
现在处于业务上的要求,需要查询这样的数据,条件必须满足:field_code like'complainTarget%'、field_code like'anlyProductType%'、field_value='H1_03_070303'、t.field_value='4'查询出满足上述四个条件的所有数据,注意四个条件必须同事满足,小弟在线等答案。
现在处于业务上的要求,需要查询这样的数据,条件必须满足:field_code like'complainTarget%'、field_code like'anlyProductType%'、field_value='H1_03_070303'、t.field_value='4'查询出满足上述四个条件的所有数据,注意四个条件必须同事满足,小弟在线等答案。
解决方案 »
- In条件中字符串的转换问题
- 高手,瞧瞧,小问题,但我不会写了,谢谢!
- 统计产品的价格货币汇率由1月1变(以前的汇率不变)改为1日1变,查询统计怎么修改最方便?以前的汇率是月汇率,现在的汇率是日汇率
- 视图中写三表连接.请各位高手帮帮我!
- 如何写一个bat文件启动Oracleora92TNSListener和OracleServiceORA9I !
- 请教一条SQL语句
- 数据访问问题
- 有谁说一下在ORACLE中用事务的一些体会?
- sql文件能否带参数?
- oracle延时问题?
- JAVA中的Double.isNaN,ORACLE里怎么实现?
- 查询a,b,c三个表的一些字段 可是b表需要UNION ALL b的历史表 可以实现吗?
FIELD_ID SHEET_NO FILED_CODE
1 8a7488ac2f3fe602012f4239e57d0bb6 GZ2011041100049 complainTarget_0
FILED_VALUE INDEX_ID
H1_03_070303 4
2 8a7488ac2f3fe602012f4239e57d0bb7 GZ2011041100049 productCategory H1_02_01020102 5
3 8a7488ac2f3fe602012f4239e57d0bb8 GZ2011041100049 anlyProductType_0 4 23
4 8a7488ac2f3fe602012f4239e57d0bb9 GZ2011041100049 anlyBusinessType_0 4 24
select *
from tbl_sheet_content_field
where field_code like 'complainTarget%' and field_code like 'anlyProductType%' and
field_value='H1_03_070303' and t.field_value='4'
进入这个URL里面有一张图片,是关于现在表中的数据截图,大致如下:
FIELD_ID ---------------------------SHEET_NO------------ FILED_CODE
8a7488ac2f3fe602012f4239e57d0bb6---- GZ2011041100049---- complainTarget_0
FILED_VALUE------INDEX_IDH1_03_070303----- 4
8a7488ac2f3fe602012f4239e57d0bb7---- GZ2011041100049---- productCategory H1_02_01020102--- 5
8a7488ac2f3fe602012f4239e57d0bb8---- GZ2011041100049---- anlyProductType_0
4---------------- 23
8a7488ac2f3fe602012f4239e57d0bb9---- GZ2011041100049---- anlyBusinessType_0
4---------------- 24红色字体为字段名 下面的为数据,现在我需要查询出的数据需满足如下条件:
field_code like'complainTarget%' 和 field_value='H1_03_070303' 为一个条件
t.field_code like'anlyProductType%' 和 field_value='4' 又是一个条件且这四个条件必须同时满足,苦恼啊!
field_code like'complainTarget%' 和 field_value='H1_03_070303' 为一个条件
t.field_code like'anlyProductType%' 和 field_value='4' 又是一个条件且这四个条件必须同时满足
select *
from tbl_sheet_content_field
where (field_code like 'complainTarget%' and field_code like 'anlyProductType%') or
(field_value='H1_03_070303' and t.field_value='4')
from tbl_sheet_content_field
where field_code like 'complainTarget%' and field_value='H1_03_070303' and
(field_code like 'anlyProductType%' or t.field_value='4')
from tbl_sheet_content_field
where (field_code like 'complainTarget%' or field_code like 'anlyProductType%') and
(field_value='H1_03_070303' or t.field_value='4')
(field_code like 'complainTarget%' or field_code like 'anlyProductType%' )
and (field_value='H1_03_070303' or t.field_value='4')
from tbl_main_sheet m,
tbl_sheet_content_field c
where m.main_sheet_flow_no = c.sheet_flow_no
and ( c.field_Code like 'complainTarget%' or
c.field_Code like 'anlyProductType%')
and (c.field_Value in ('H1_03_070303') or
c.field_Value = '4')
group by c.sheet_flow_no
having count(*) > 1