I have the following tables:
- tag
- tag_names
- workout_names
- workout_tags
- workouts
My goal is to retrieve the workouts and tags in a result set which would go like like this.
workout
workout_tags
workout
workout_tags
I can retrieve one which is not a problem:
DELIMITER $$
CREATE PROCEDURE get_workouts_menu(IN _language SMALLINT(255))
BEGIN
DECLARE workout_id INTEGER;
SELECT w.workout_id,ROUND((w.duration / 1000) / 60) AS duration,w.isCustom,w.purchased,wn.name FROM workouts AS w INNER JOIN workout_names AS wn ON w.workout_id=wn.workout_id WHERE wn.language=_language ORDER BY w.isCustom DESC,wn.name ;
#workout_id = QUERY ABOVE... you get the point
#SELECT tag_id FROM workout_tags WHERE workout_id = workout_id;
#SELECT * FROM tag_names WHERE tag_id = nn;
END$$
You get the point ,my question is how to be able to retrieve multiple workout tables and multiple tag tables.I'm having issues of saving the id also when there are more.As you can see in my code above, on i can get but how could i get one by one, or if someone has a better approach.Thanks...