I am trying to do a select that will display events by category, but will NOT display a category name if it is empty (has no events).
2 tables: categories and events events contains a field called category_id that corresponds to the id of a category in categories. I am doing a 'while' loop for the events inside a 'while' loop for the categories. It displays the category, then all events for that category. I am trying to find a simple way to NOT display the category if there are no events in that category. This seems logical, but does not produce any output: "SELECT category from categories WHERE categories.id = events.category_id" I can envision ways of getting this result that are more complicated that they should be. Is there a fairly simple way ? BTW, I just joined this list and this is my first post. Let me know if I am being unclear. Thanks, RD --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php