Re: Selecting unique values from a db

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

 



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 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        |
_____________________________________


Not 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.com





--
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