weardstuff
weardstuff

Reputation: 807

Select those who doesn't repeat

How to select like if I have columns with rows

column
row1
row1
row2
row3
row3

And when outputting all rows, only to output like..

row1
row2
row3

If there is rows with same value, I want to output them just once.

Upvotes: 1

Views: 102

Answers (2)

Nanne
Nanne

Reputation: 64409

Either use

SELECT DISTINCT(column) FROM TABLE

or

SELECT column FROM TABLE
GROUP BY column

Upvotes: 0

Headshota
Headshota

Reputation: 21449

SELECT DISTINCT `fieldname` FROM `mytable`

Upvotes: 1

Related Questions