I’ve got 5 tables. The main tables are: RisCtx, RisObj, and Ris.
RisCtx *———–* RisObj
RisObj *———–* Ris
(*—* = many-to-many)
So I got 2 more tables called: RisCtxRisObj and RisObjRis (for the many-to-many).
What I want is to create a view that collects all records from RisCtx which have a connection to Ris trough RisObj.
I’ve got kinda no clue :(.. I read something about INNER JOINs but I don’t see a bit clearance…
The schema

CREATE VIEW `mydb`.`CtxView_CtxFromObj_ObjFromRisk` AS
select RisCtx.*
from RisCtx
inner join RisCtxRisObj on RisCtx.id=RisObjRisCtx.RisCtx_id
inner join RisObj on RisObjRisCtx.RisObj_id=RisObj.id
inner join RisObjRis on RisObj.id=RisObjRis.Objective_id
inner join Ris on RisObjRis.Risk_id=Ris.id
Since you haven’t provided a schema, I can’t show you what your
ONclauses should look like, but the basic query structure is: