如上图需要统计current_num的后面减前面一个的差值with test as(select rownum rn, a.place_name,b.name,b.no,b.read_type,c.collection_date,c.current_num from T_ENERGY_WORKPLACE_INFO a,T_ENERGY_GAUGES_INFO b,t_energy_gauges_read cwhere a.workplace_id=b.workplace_id and b.gauges_id=c.gauges_idand b.WORKPLACE_ID='8acea74e3e063e98013e10c7d3fb01da'order by a.place_name,b.name,c.collection_date )select d.*,d.current_num-e.current_num as temp from test d,test ewhere e.rn1=d.rn() order by d.rn;with是根据需求申明一个数据
表
关于同志近三年现实表现材料材料类招标技术评分表图表与交易pdf视力表打印pdf用图表说话 pdf
如下图然后select的时候用e表rn1来和d.rn来作条件,然后再去求差值最终得的结果为注意如果我们只用?传参数的时候,如果不用with申明一张表,就或要传两个参数,实际上只有一个,所以with解决参数只需要传一个参数的问题