Selecting unique values from a db

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux