Re: Selecting unique values from a db
| From: | John W. Holmes | Date: | Wed, 18 Jun 2003 11:20:12 +0000 |
| Subject: | Re: Selecting unique values from a db | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-28711@lists.php.net to get a copy of this message | ||
mike karthauser wrote:
Being thick today: How do I select unique values from a table? Eg I have a image upload script that writes the name of the file to a db when it uploads. As we may need to upload the image several times, my db is full up with several rows with same titles.. Eg: img dbNot really a PHP question... SELECT DISTINCT title FROM ... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals – www.phparch.comid | title | short-title |-------------------------------------1 | pie.jpg | pie | 2 | pie.jpg | pie | 3 | pie2.jpg | pie2 |_____________________________________ How do I get results as SELECT * FROM img WHERE ?? ORDER BY title Results -------------------------------------1 | pie.jpg | pie | 3 | pie2.jpg | pie2 |_____________________________________