13

Hi does Hive support distinct on multiple columns. like select distinct(a, b, c, d) from table. If not is there a way to achieve this?

Sachin Janani
  • 1,310
  • 1
  • 17
  • 33
Bhaskar Mishra
  • 3,332
  • 7
  • 26
  • 36
  • Yes, Please refer to following link on how to use distinct https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Select#LanguageManualSelect-ALLandDISTINCTClauses – Hussnain Mar 13 '14 at 19:15

1 Answers1

10

Yes, Hive does support distinct on multiple columns. You can do that by following

SELECT distinct col1, col2, col3 from TABLE

If you want to select distinct rows, you can use * instead

SELECT DISTINCT * FROM TABLE
kjsr7
  • 397
  • 4
  • 20