clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 921276 fiddles created (11969 in the last week).

CREATE TABLE trajectory_data (traj_id int, timestamp date, height int, lat real, lon real); INSERT INTO trajectory_data VALUES ('1', '2006-01-01', '10', '34.55', '-70.80'), ('1', '2006-01-02', '9', '34.56', '-70.88'), ('1', '2006-01-03', '0', '34.56', '-70.89'), ('1', '2006-01-04', '5', '34.57', '-70.90'), ('1', '2006-01-05', '20', '34.60', '-70.94'), ('2', '2006-01-01', '10', '34.55', '-70.80'), ('2', '2006-01-02', '5', '34.55', '-70.82'), ('2', '2006-01-03', '3', '34.54', '-70.89'), ('2', '2006-01-04', '0', '34.53', '-70.90'), ('2', '2006-01-05', '10', '34.51', '-70.95'), ('3', '2006-01-01', '10', '34.55', '-70.80'), ('3', '2006-01-01', '9', '34.56', '-70.75'), ('3', '2006-01-01', '11', '34.54', '-70.90'), ('3', '2006-01-01', '15', '34.60', '-70.95'), ('3', '2006-01-01', '30', '34.67', '-70.90') ;
15 rows affected
 hidden batch(es)


SELECT * FROM ( SELECT *, count(*) FILTER (WHERE height = 0) OVER (PARTITION BY traj_id ORDER BY timestamp) AS ct0 FROM trajectory_data ) sub WHERE ct0 = 0;
traj_id timestamp height lat lon ct0
1 2006-01-01 10 34.55 -70.8 0
1 2006-01-02 9 34.56 -70.88 0
2 2006-01-01 10 34.55 -70.8 0
2 2006-01-02 5 34.55 -70.82 0
2 2006-01-03 3 34.54 -70.89 0
3 2006-01-01 10 34.55 -70.8 0
3 2006-01-01 9 34.56 -70.75 0
3 2006-01-01 11 34.54 -70.9 0
3 2006-01-01 15 34.6 -70.95 0
3 2006-01-01 30 34.67 -70.9 0
 hidden batch(es)