There are 3 tables

content: id|name|text category: id|name contact: id_content|id_category 

I need to get all the categories, one of the content, and display their names.

tobish as a result: content => (category1, category5, category20)

  • What do you have at the entrance? content.id, content.name or something else? - Deonis
  • @Deonis at content.id entry - Bastian 1:09 pm
  • 3
    @ rnddev, test [can be here] [1] SELECT cat . name FROM category cat INNER JOIN contact cont ON ( cat . id = cont . id_category ) WHERE cont . id_content =? [1]: sqlfiddle.com/#!2/1e3b8/3/0 - Deonis
  • @Deonis thank you. - Bastian

1 answer 1

Deonis Comment Response

 SELECT cat.name FROM category cat INNER JOIN contact cont ON cat.id = cont.id_category WHERE cont.id_content = ?