Selecting unique values from a db
| From: | mike karthauser | Date: | Wed, 18 Jun 2003 11:13:25 +0000 |
| Subject: | Selecting unique values from a db | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-28710@lists.php.net to get a copy of this message | ||
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 db
id | 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 |
_____________________________________
Many thanks/
mikek
--
Mike Karthauser
Managing Director - Brightstorm Ltd
Email >> mikek@brightstorm.co.uk
Web >> http://www.brightstorm.co.uk
Tel >> 0117 9426653 (office)
07939 252144 (mobile)
Snailmail >> Unit 8, 14 King Square,
Bristol BS2 8JJ