WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] *tough* SQL query question (3 posts)

  1. tedwardo24
    Member
    Posted 8 years ago #

    Im running a query on my database that has a list of my mp3's. I want to know how many DIFFERENT albums I have (so repeats should not be counted).

    Example:
    I have 5 pink floyd albums, so in each row of my database I have each individual song from those albums, and in the 'album' column I have what album each song belongs to. So, I want to just fetch the 5 album names.

    How would I run a query??

    SELECT * ... FROM 'mp3s' WHERE ... ??

    Please let me know. Much appreciated!

  2. skippy
    Member
    Posted 8 years ago #

    SELECT DISTINCT(album) FROM mp3s LIMIT 5;

    or

    SELECT DISTINCT(album) FROM mp3s WHERE artist='Pink Floyd';

  3. tedwardo24
    Member
    Posted 8 years ago #

    skippy = my new personal hero

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags