Howto Select rows that match the intersection of multiple rows in other tables in MYSQL? -


It looks complicated (and perhaps it is). But I can not imagine how to solve it.

Tables are:

Company
ID | Name
1 | Google
2 | Samsung
3 | Microsoft

Parades S
ID | Name
1 | Header
2 | Body || 3 Footer

Tags
id | Tags
1 | Internet | 2 | Softwetts

COMPANIES_VS_TAGS
ID | Company_id | Tag_ id
1 | 1 | 1 2 | 2 | 2
3 3 | 1 4 4 3 | 2

PARAGRAPHS_VS_TAGS
ID | Paragraph_id | Tag_ id
1 | 2 | 1
1 | 2 | 2

I must select all the companies, which belongs to the [any_number] tag of the paragraph by logical and

Therefore, the above examples In, the physical paragraph should only produce the "Microsoft" company.

Add: I can use only WHERE and sub queries : this is the limit of CMS that I have to use.

Learn how INNER JOIN works.



Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -