I'm having trouble generating what I want from just one single query.
I have 3 tables: uc_videos, uc_video_categories, and uc_list_of_parent_categories
uc_videos has the fields video_id and author_id (those are the fields relevant to this query)
uc_video_categories has the fields video_id and parent_category (parent_category is an ID #)
uc_list_of_parent_categories has the fields id and category (category is text field, containing the text name of the parent category id)
What I'm trying to generate is a list of categories, with the number of videos that a specific has uploaded for each category. If I can get a list of videos with their corresponding text-version category, I can generate the numbers with PHP after the sql.
I'm so lost, not even sure where to start! I've read more on joins, and still cannot figure it out. Please help! Thanks!
My current sql, which doesn't contain all the joins I think I need, as well as it doesn't even work, gives me an error:
Code:
SELECT a.video_id, category
FROM uc_video_categories AS a, uc_list_of_video_parent_categories AS c, uc_videos as e
INNER JOIN (SELECT video_id FROM uc_videos WHERE author_id = '16') AS f ON f.video_id = a.video_id