COUNT(DISTINCT expression[,expression...])

Description: Returns the number of rows retrieved in a SELECT statement where values of expression are distinct and not NULL. Generally used with GROUP BY clause.

Examples:

SELECT COUNT(DISTINCT city_name)
  FROM weather

returns the total number of different cities named.

SELECT city_name, COUNT(DISTINCT temperature)
  FROM weather
  GROUP BY city_name

returns the number of different temperatures recorded, for each city.

See also: COUNT()

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.34.62