Page 1 of 1

Showing a db value only once per output. Possible?

Posted: Wed Jul 20, 2005 8:14 pm
by doffer
I have a table which stores information for my media review system, and that table have ten fields..

Release data, title, artist and a few others...

The artist field contains the artist/performer name. I want to output a list of all artists starting with a specific letter.. That could be done running the query;

Code: Select all

SELECT *
FROM `cd`
WHERE `artist` LIKE 'b%'
ORDER BY `artist` ASC
LIMIT 0 , 100
But then I'll get all the rows having an artist starting with the letter, in this case, b. I want it to only show the artist once. If someone could tell me how to strip out the artists appearing more than once, it would be splendid :D

I have only written php for a week or so, and have allready written my own mini-"CMS" located at http://doffer.net/samler/. *proud newbie* :)

Solved!

Posted: Wed Jul 20, 2005 8:19 pm
by doffer
Solved the problem my self... I altered the query to:

Code: Select all

SELECT DISTINCT `artist`
FROM `cd`
WHERE `artist` LIKE 'b%'
LIMIT 0 , 30
A lot more fun solving own problems :)

Have a nice day!