Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 447

Remove rows based on duplicated values in one column

$
0
0

I have the below sample table and I need a second table without duplicate grouped values from column 'Values'

+----+--------+| Id | Values |+----+--------+| 1  | A      || 2  | B      || 3  | B      | <--remove| 4  | A      || 5  | A      | <--remove| 6  | A      | <--remove| 7  | B      || 8  | A      || 9  | A      | <--remove| 11 | B      || 12 | B      | <--remove| 13 | B      | <--remove| 14 | B      | <--remove| 15 | C      | +----+--------+

The result table must be:

+----+--------+| Id | Values |+----+--------+| 1  | A      || 2  | B      || 4  | A      || 7  | B      || 8  | A      || 11 | B      || 15 | C      |+----+--------+

I've been trying with GROUP BY, DISTINCT, and ROW_NUMBER() statements without success. I can't figure out how construct a working SQL query.


Viewing all articles
Browse latest Browse all 447

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>