Thread: DISTINCT and COUNT help
Hi there! I would like to count the number of distinct values in a column. Is there any way to combine DISTINCT and COUNT and if so, what is the syntax? Thanks for your help! Julie
Hi Julie, >I would like to count the number of distinct values in a column. Is >there any way to combine DISTINCT and COUNT and if so, what is the >syntax? Sure is. SELECT DISTINCT column, COUNT(column) FROM table GROUP BY column; HTH, ----------------- Chris Smith http://www.squiz.net/
On Fri, 28 Jun 2002 00:10:56 -0500, Julie Keywell <julie@iparenting.com> wrote: >I would like to count the number of distinct values in a column. Is >there any way to combine DISTINCT and COUNT and if so, what is the >syntax? Julie, it's so obvious, you didn't dare to think of it :-) SELECT COUNT(DISTINCT col) FROM t; Servus Manfred
Julie: --- Julie Keywell <julie@iparenting.com> wrote: > Hi there! > > I would like to count the number of distinct values > in a column. Is > there any way to combine DISTINCT and COUNT and if > so, what is the syntax? try SELECT COUNT(DISTINCT(<column name>)) FROM ..... ludwig __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com