-1
id_session,x,z,time
1,-10,-10,0
1,-10,-10,1
1,-5,-4,2
私はこの機能を持っている:関数にテーブルを挿入するにはどうすればよいですか?
Select x.x,x.z,sum(case when x=nextlat and z=nextlng then 0 else 1 end) s
From
( Select x,
z,
lead(x,1,-9999) over (order by tempo) nextlat,
lead(z,1,-9999) over (order by tempo) nextlng
from xmltrack where id_session = 1
) x
Group by x.x,x.z
order by s desc
私は、パラメータとしてid_sessionで関数を作成する方法は?このような 何か:私はid_sessionを想定してい
CREATE OR REPLACE FUNCTION xmlintersezioni (idsession integer)
RETURNS TABLE (cx integer, cz integer, cs integer) AS $$
BEGIN
RETURN QUERY Select x.x,x.z,sum(case when x=nextlat and z=nextlng then 0 else 1 end) s
From
(select x,
z,
lead(x,1,-9999) over (order by tempo) nextlat,
lead(z,1,-9999) over (order by tempo) nextlng
from xmltrack where id_session = idsession
) x
Group by x.x,x.z
order by s desc;
END; $$
LANGUAGE 'plpgsql';
xmlintersezioniの問題は何ですか? –