Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

get distinct elements in table psql

postgres=#  select distinct on (col1) col1,col2,col3 from test order by col1;

 col1 | col2 |    col3    

------+------+------------

    1 | abc  | 2015-09-10

    2 | xyz  | 2015-09-13

    3 | tcs   | 2015-01-15

(3 rows)
Source by www.enterprisedb.com #
 
PREVIOUS NEXT
Tagged: #distinct #elements #table #psql
ADD COMMENT
Topic
Name
2+9 =