[PHP-DB] Return 1 instance of each unique record?

2002-12-06 Thread Doug Coning
Hi everyone:

How do I get MySQL to summarize a query so that I receive only 1 instance
per similar record.  I.E. if you have 10 records with name Smith and 5
records with Barney, etc, that it would return 2 records instead of 15.

Thanks!

Doug Coning




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Return 1 instance of each unique record?

2002-12-06 Thread 1LT John W. Holmes
 How do I get MySQL to summarize a query so that I receive only 1 instance
 per similar record.  I.E. if you have 10 records with name Smith and 5
 records with Barney, etc, that it would return 2 records instead of 15.

This should be on a MySQL list...

SELECT * FROM tbl WHERE ... GROUP BY column

The key is the GROUP BY part... check the manual for more of an explanation.

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Return 1 instance of each unique record?

2002-12-06 Thread Adam Williams
use GROUP BY field

Adam

On Fri, 6 Dec 2002, Doug Coning wrote:

 Hi everyone:

 How do I get MySQL to summarize a query so that I receive only 1 instance
 per similar record.  I.E. if you have 10 records with name Smith and 5
 records with Barney, etc, that it would return 2 records instead of 15.

 Thanks!

 Doug Coning







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Return 1 instance of each unique record?

2002-12-06 Thread DL Neil
Hi Doug,

 How do I get MySQL to summarize a query so that I receive only 1 instance
 per similar record.  I.E. if you have 10 records with name Smith and 5
 records with Barney, etc, that it would return 2 records instead of 15.


Try the MySQL DISTINCT feature.
=dn


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Return 1 instance of each unique record?

2002-12-06 Thread Doug Coning
Thanks everyone...

I find my problem often time is terminology.  I am a FileMaker database
developer and know the terminology of that database.  I love MySQL,
especially it's speed, but find crossing over sometimes difficult because
the terminology is different and so I will do a search at MySQL on the
terminology I'm used to, which in this case was summarize byand found
nothing.  Then I have to bother you guys to find out what the correct
verbage is.

Thank you for your patience!

Doug
- Original Message -
From: Adam Williams [EMAIL PROTECTED]
To: Doug Coning [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, December 06, 2002 2:27 PM
Subject: Re: [PHP-DB] Return 1 instance of each unique record?


 use GROUP BY field

 Adam

 On Fri, 6 Dec 2002, Doug Coning wrote:

  Hi everyone:
 
  How do I get MySQL to summarize a query so that I receive only 1
instance
  per similar record.  I.E. if you have 10 records with name Smith and 5
  records with Barney, etc, that it would return 2 records instead of 15.
 
  Thanks!
 
  Doug Coning
 
 
 
 
 





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php