Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

PHP/MySQL, please help.?

So I have a query pulling subcategories from a table of museum exhibits. It looks something like:

SELECT subcategory FROM exhibits;

and returns the subcategory for all 200+ entries. The problem is that I need to generate a list of the different subcategories, and I'd rather not have a separate table of subcategories. That is, I need something like this:

SELECT subcategory FROM exhibits {BUT ONLY SHOW EACH SUBCATEGORY ONCE};

PHP string functions are a totally valid option... My first thought was to use strcompare(), but I can't quite reason out how to do it.

1 Answer

Relevance
  • Rav
    Lv 4
    1 decade ago
    Favorite Answer

    SELECT DISTINCT subcategory FROM exhibits

Still have questions? Get your answers by asking now.