MySQL get header from parent with two tables
I will try to explain as much as possible. here is my request ..
SELECT * FROM mm_star_ratings s
JOIN mm_posts p ON s.post_id = p.postid
WHERE p.type='B'
ORDER BY s.rating DESC LIMIT 5
type='B'
is the main post and type='C'
is the answer to this post. There mm_posts
is a column parentid
to set the main post (B)
id for C
. I want to get title
from mm_posts
if type='C'
all the same?
The challenge for me is to get it to work with my rating table where post_id
both are set for B
and forC
source to share