Postgresql databse with duplicate rows keep only the rows with true -


i've got 3 columns: groupid id yes/no/1

the database consists of rows duplicate values group (same group) want remove duplicate groups , have uniek group values. want keep te duplicate rows yes , remove rest.

so: if have 100 rows groupid 502 , there 400 no's, 50 "1", , 50 yes want have 1 row groupid 502 , should yes.

please help

use distinct on remove duplicate rows.

select distinct on (groupid) groupid, column_3 table_name column_3 'yes'; 

Comments

Popular posts from this blog

PHP while loop dynamic rowspan -

timer - Java TimerTask cancel -

android - How to read a column value in parse.com without accessing an object or a pointer -