select t1.ogf_id, t1.structure_unit_id, t1.ogf_name, t1.ogf_no, t1.field_type_code, t1.parent_ogf_id, t1.geography_loc, t1.longitude, t1.org_id, t1.sea_area, t1.object_state_code, to_date(t1.begin_date,'yyyy-mm-dd') as begin_date, to_date(t1.end_date,'yyyy-mm-dd') as end_date, t1.remark, t1.ODP_OilRate, t1.ODP_GasRate, t1.FieldArea, t1.RegionID, t1.DiggingID, t1.DataSourceTypeCode, t1.Order_Number, t3.oldname, t3.oldvalues, t3.z_clear_datainfos_id from PPD_Register_OGFS t1 left join (select newvalues ,fulutable_enname,listagg(oldname, ',') within group(order by oldname) oldname,listagg(oldvalues, ',') within group(order by oldvalues) oldvalues,listagg(z_clear_datainfos_id, ',') within group(order by z_clear_datainfos_id) z_clear_datainfos_id from "z_clear_datainfos" zcd where fulutable_enname = 'PPD_Register_OGFS' group by newvalues,fulutable_enname) t3 on t1.ogf_id= t3.newvalues where ( @field_id@ is not null and ogf_id in ( SELECT ogf_id FROM JOINT_FIELDS_IN_FIELD WHERE parent_ogf_id in (@field_id@) ) ) or (@field_id@ is null and @ogf_name@ is null) or (@field_id@ is null and t1.ogf_no like @ogf_name@) or ((@field_id@ is not null and @ogf_name@ is not null) and (t1.ogf_no like @ogf_name@)) order by Order_Number
时间: 2024-04-09 19:32:17 浏览: 171
根据您提供的SQL查询语句,它的功能是从表PPD_Register_OGFS中查询相关数据,并且根据条件进行筛选和排序。具体的排序规则是按照列Order_Number进行升序排序。
在查询结果中,选择了一系列的列,包括 t1.ogf_id, t1.structure_unit_id, t1.ogf_name, t1.ogf_no, t1.field_type_code, t1.parent_ogf_id, t1.geography_loc, t1.longitude, t1.org_id, t1.sea_area, t1.object_state_code, t1.begin_date, t1.end_date, t1.remark, t1.ODP_OilRate, t1.ODP_GasRate, t1.FieldArea, t1.RegionID, t1.DiggingID, t1.DataSourceTypeCode, t3.oldname, t3.oldvalues, t3.z_clear_datainfos_id。
同时,使用了左连接(left join)将表"z_clear_datainfos"与表PPD_Register_OGFS进行关联,并使用子查询对表"z_clear_datainfos"进行聚合操作,按照列newvalues和fulutable_enname进行分组,并使用listagg函数对列oldname、oldvalues和z_clear_datainfos_id进行了合并。
在WHERE子句中,根据一系列条件进行了筛选,包括对字段@field_id@和@ogf_name@的判断和匹配。
最后,使用ORDER BY子句对结果按照列Order_Number进行升序排序。
请注意,我只是解释了您提供的SQL查询语句的含义,我并不会执行该查询。如果您有需要,可以将该查询语句用于您的数据库环境中。
阅读全文