mysql - join elements from three unrelated tables -


sql newbie here. have following schema.

i provide list of active primary super charged domains belonging foobar association.

as far know, 3 tables (sites, domain, , name) cannot joined together. how can done?

this example of joining 3 tables

select * companies join sites on sites.company = companies.id join domains on domains.site = sites.id      sites.is_supercharged = 1 , sites.is_deleted = 0 ,      domains.is_primary = 1 , domains.is_deleted = 0 

it based on schema (i hope field names correct, text quite small)

when joining table query, need specify matching fields reference in on part. , can add condition in where part.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -