lovespring
lovespring

Reputation: 19589

How to count diffrent rows in MySQL ? (three columns as a whole)

How to count rows with distinct values on any of the three columns: col1, col2, col3?

Upvotes: 1

Views: 194

Answers (2)

Rubens Farias
Rubens Farias

Reputation: 57996

Blind kick:

SELECT count(*) FROM YourTable
WHERE  Col1 <> Col2 OR Col1 <> Col3 OR Col2 <> Col3

Upvotes: 0

Quassnoi
Quassnoi

Reputation: 425813

SELECT  COUNT(DISTINCT col1, col2, col3)
FROM    mytable

Upvotes: 4

Related Questions