I have three tables in database:
user_tbl: userID | name | email | password
task_tbl: taskID | description | Date
usertask_tbl: userID | taskID
Now i want to display all the tasks related to one user, it should go and get check the taskid of that user and show all the description and date for that user. But instead its showing one description and date.
Here is my stored procedure:
CREATE DEFINER=`root`@`localhost` PROCEDURE `alltask`(IN `useremail` INT(11))
BEGIN
SELECT @userID := userID FROM user_tbl WHERE email=useremail;
SELECT @TaskID :=taskID from usertask_tbl WHERE userID = @userID;
SELECT description, Date from task_tbl WHERE taskID = @TaskID;
END
I'm new to this. If this is not the right way to do it please help me.