List:General Discussion« Previous MessageNext Message »
From:Jim Faucette Date:May 1 1999 2:53pm
Subject:Re: DISTINCT and COUNT() SQL Query
View as plain text  
Mike Machado wrote:
> 
> Yes! I want the number of distinct names. None of the earlier queries give me
> what I'm looking for. I want the number of distinct names in the same way as
> a 'select count(*) from names' would, exept that would give me all the
> entries (count the same name multiple times).
> 

There is one other method (two steps):
  SELECT INTO temp_table SELECT DISTINCT name FROM main_table;
  SELECT COUNT(*) FROM temp_table;

  jim...
Thread
DISTINCT and COUNT() SQL QueryMike Machado1 May
  • Re: DISTINCT and COUNT() SQL Queryjkraai1 May
    • Re: DISTINCT and COUNT() SQL QueryPaul DuBois1 May
  • RE: DISTINCT and COUNT() SQL QueryDon Read1 May
  • Re: DISTINCT and COUNT() SQL QueryMike Machado1 May
    • Re: DISTINCT and COUNT() SQL QueryThimble Smith1 May
  • Re: DISTINCT and COUNT() SQL QueryJim Faucette1 May
  • 3.22.21 RAM Usagejkraai2 May
    • 3.22.21 RAM UsageMichael Widenius2 May
  • Re: 3.22.21 RAM Usagejkraai2 May
  • a problemglen19 May
    • Re: a problem (The table 'SQL134597_0' is full)Pete Harlan20 May
      • Re: a problem (The table 'SQL134597_0' is full)glen20 May
        • Re: a problem (The table 'SQL134597_0' is full)Benjamin Pflugmann21 May
        • Re: a problem (The table 'SQL134597_0' is full)Michael Widenius24 May