如果object_id相同,如何通过MySql和Php获取结果

Values inserting in 3 table

Table1: wp_terms

enter image description here

Table2: wp_term_taxonomy

enter image description here

Table3: wp_term_relationships

enter image description here

I need ouput like this(i want fetch all brand and designer based on category)

enter image description here

I have tried this

$sql="select term_taxonomy_id from wp_term_taxonomy where term_id=177";
mysql_query($sql);

I got output 251

But I am stuck in Table3: wp_term_relationships on how to fetch data where object_id are similar: 550, 540(for category, band, designer )

I guess the query shd look like this:

SELECT m.name, t.taxanomy, t.description from wp_term_relationships r
INNER JOIN  wp_term_taxonomy t on r.term_taxonomy_id = t.term_taxonomy_id
INNER JOIN wp_terms m on m.term_id=t.term_id  
WHERE (r.object_id=550 or  r.object_id=540) and t.term_id=177