I've a project where I submitted all the records to notification table
, now I want to fetch according to the session_id
's activity
Details: My project is Q&A question and answer platform, I've separate tables
in my database for each activity. e.g, questions
, answers
, question-upvote
, answers-like
, comments
, comments-like
, etc. I also have a table
for notifications
, where there are 7 - Columns
exist. id
, date
, byUser_id
, source_id
, alert
, source_type
, and status
.
Notifications Structure - Image Attached:
Now after insert records in notifications
table, I want to fetch the records according to the session_id's content (if someone liked the session_id
's answer, how to fetch? That is my question.
Trying Query:
SELECT id,byUser_id,source_id,alert,source_type
FROM `qa-notifications`
FULL JOIN `qa-questions` `qa-notifications`.`source_id` = `qa-questions`.`id`
WHERE `qa-question`.`user_id` = '".$_SESSION['id']."'";