W
W
wagwandude2017-01-20 14:16:39
MySQL
wagwandude, 2017-01-20 14:16:39

How to link 3 tables?

Hello.
There are 3 tables:
posts - posts are stored (id)
categories - created categories (id)
item_category - category connection with a post (post_id, category_id
) categories?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2017-01-20
@wagwandude

SELECT * FROM categories
INNER JOIN item_category ON item_category.category_id = category.id
INNER JOIN posts ON posts.id = item_category.post_id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question