I have Two Table One to store Questions and Other to store Replies to Questions as Below
I have Shown the Table Structure and Column in table as Below
Question Table
Question_Id(PK) | Question | Name | EmailAddress
Answer Table
Answer_Id | Question_Id | Question | Name | EmailAddress
What ever question is posted it will be added to Question table and What ever Replies people post will be added to answer table
Now when ever Some one post a Reply to Question I Should Send mail to one who Posted Question and to those who posted Replies to the Question
Please Suggest a mysql Query for the above
Thank you
In theory you should know in the application the id of the question (qid) someone is replying to. Based on this id you can issue the following query:
Depending on the logic of your application this might also select the address of the current user. If you want to avoid this you should include in both select statments a condition to exclude the current replier. Something like: