postgresql - sql delete based on group by -


i have following query:

select user_id, trajectory_id, count(trajectory_id) point group user_id, trajectory_id 

it returns following result: enter image description here

and want delete records point table count in produced table < 5.

right have following query, not compiling. wrong , how can fix it?

delete  point count(trajectory_id) < 5 group user_id, trajectory_id 

i using postgres.

delete p1 point p1 join (   select user_id, trajectory_id    point    group user_id, trajectory_id   having count(trajectory_id) < 5 ) p2 on p1.user_id = p2.user_id     , p1.trajectory_id = p2.trajectory_id  

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -