Daddy-O
New Member
Hi,
I have a supposedly standard question but I am a bit in a hurry and while I know my SQL to join a set of normalized tables I am a beginner with Fabrik.
I don't understand how I do chained many to many joins with Fabrik.
Let me explain what I'm looking for:
I have three main tables, lets say categories, sections and books.
I need to have
?a form that enables me to insert book records and at the same time let me select multiple options of categories and sections related to the book I am inserting
?a front end view that I can filter on categories and sections so I only get the relevant books shown
Now in standard SQL this would need 4 joins:
SELECT * FROM books b
INNER JOIN (books_x_sections
INNER JOIN (sections
INNER JOIN (sections_x_categories
INNER JOIN categories ON sections_x_categories.cid = categories.id)
ON sections.id = sections_x_categories.sid)
ON books_x_sections.sid = sections.id)
ON books.id = books_x_sections.bid)
From the tutorial video example with two tables joined by many to many I understand that you need to use a crosstable with fk's and you can join a joined table on this crosstable
but how to get it done with three tables like above and get the form and front end view I need I don't understand.
Please somebody give me an explanation how to get this done.
I have a supposedly standard question but I am a bit in a hurry and while I know my SQL to join a set of normalized tables I am a beginner with Fabrik.
I don't understand how I do chained many to many joins with Fabrik.
Let me explain what I'm looking for:
I have three main tables, lets say categories, sections and books.
I need to have
?a form that enables me to insert book records and at the same time let me select multiple options of categories and sections related to the book I am inserting
?a front end view that I can filter on categories and sections so I only get the relevant books shown
Now in standard SQL this would need 4 joins:
SELECT * FROM books b
INNER JOIN (books_x_sections
INNER JOIN (sections
INNER JOIN (sections_x_categories
INNER JOIN categories ON sections_x_categories.cid = categories.id)
ON sections.id = sections_x_categories.sid)
ON books_x_sections.sid = sections.id)
ON books.id = books_x_sections.bid)
From the tutorial video example with two tables joined by many to many I understand that you need to use a crosstable with fk's and you can join a joined table on this crosstable
but how to get it done with three tables like above and get the form and front end view I need I don't understand.
Please somebody give me an explanation how to get this done.