Given a table named MyTab that contains a column named TelephoneNumber that
has 8 instances of 123-4567 in it and 3 instances of 444-4444 in it:

select distinct(TelephoneNumber) from MyTab

will give you each of the phone numbers, once each, i.e. the result will be:
123-4567
444-4444

This query:

select count(distinct TelephoneNumber) from MyTab

will tell you how many different phone numbers there are, i.e. the result
set will be:
2

I can't think of a way to give you both quantities in the same query though.

Rhino

----- Original Message ----- 
From: "Jan Blomqvist" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 15, 2004 8:27 AM
Subject: any select statement like uniq in unix


> Hi! Is there a select statement , wich works like the command uniq in
unix,
> if I shall list a table with a column wich for example is telephonenumber
> and the same number occurs like 1000 times, and I wan,t i present just
once
> and also the count how many times it occurs in the table.
>
>
> /Jan Blomqvist
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to