I have written a procedure that shows me the image path from picture table and I want to calculate the no. of unread messages.Here is what i am doing
CREATE PROCEDURE datehate.dashboard_message(IN UserID INT)
BEGIN
SELECT picture.path_thumb,status
FROM picture,message,user_profile
WHERE (
(message.receiver_user_id=UserID)
AND
(user_profile.user_id=message.sender_user_id AND picture.picture_id=user_profile.picture_id)
);
END
And this the output i am getting
path_thumb status
E:\DateOrHateUser\DEMO_2_Stockhlom\images\Male\1#j... UNREAD
E:\DateOrHateUser\DEMO_2_Stockhlom\images\Male\3#j... READ
E:\DateOrHateUser\DEMO_2_Stockhlom\images\Male\5#j... UNREAD
use
to get the number of records returned
and put
in your WHERE condition