I'm trying to create a report that lists all the products in the Actinic Database along with all the Sections and subsections.
I'm not 100% sure on how to join the tables.
This is the data I need
Section
Sub Section
Sub Sub Section
Product
The thing is that every section varies on how many sub sections there are in it.
Eg
Dogs (MAIN SECTION)
--> Dog Beds (SUB SECTION)
--> --> Plush Dog Beds(SUB SUB SECTION)
--> --> --> Luxurious Comfy Dog Bed 16" (PRODUCT)
--> --> --> Luxurious Comfy Dog Bed 18" (PRODUCT)
--> Dog Toys (SUB SECTION)
--> --> Latex Squeaky Bear 4" (PRODUCT)
--> --> Latex Squeaky Dog 6" (PRODUCT)
This is my sql, would appreciate any information on how I join the catalog table to the product table to see all data
SELECT
Catalog_section_3.`Section text`, Catalog_section_3.`nSectionID`,
Catalog_section_2.`Section text`, Catalog_section_2.`nSectionID`,
Catalog_section_1.`Section text`, Catalog_section_1.`nSectionID`, Catalog_section_1.`nParentSectionID`,
Catalog_section.`Section text`, Catalog_section.`nSectionID`, Catalog_section.`nParentSectionID`, Catalog_section.`bHideOnWebSite`,
Product.`Full description`, Product.`Price`, Product.`Can be ordered online`, Product.`bSuppressHtml`, Product.`nDuplicateIndex`, Product.`Short description`, Product.`sExtendedInfoImage`
FROM
(((`Catalog section` Catalog_section_3 RIGHT OUTER JOIN `Catalog section` Catalog_section_2 ON
Catalog_section_3.`nSectionID` = Catalog_section_2.`nParentSectionID`)
INNER JOIN `Catalog section` Catalog_section_1 ON
Catalog_section_2.`nSectionID` = Catalog_section_1.`nParentSectionID`)
INNER JOIN `Catalog section` Catalog_section ON
Catalog_section_1.`nSectionID` = Catalog_section.`nParentSectionID`)
INNER JOIN `Product` Product ON
Catalog_section.`nSectionID` = Product.`nParentSectionID`
I'm not 100% sure on how to join the tables.
This is the data I need
Section
Sub Section
Sub Sub Section
Product
The thing is that every section varies on how many sub sections there are in it.
Eg
Dogs (MAIN SECTION)
--> Dog Beds (SUB SECTION)
--> --> Plush Dog Beds(SUB SUB SECTION)
--> --> --> Luxurious Comfy Dog Bed 16" (PRODUCT)
--> --> --> Luxurious Comfy Dog Bed 18" (PRODUCT)
--> Dog Toys (SUB SECTION)
--> --> Latex Squeaky Bear 4" (PRODUCT)
--> --> Latex Squeaky Dog 6" (PRODUCT)
This is my sql, would appreciate any information on how I join the catalog table to the product table to see all data
SELECT
Catalog_section_3.`Section text`, Catalog_section_3.`nSectionID`,
Catalog_section_2.`Section text`, Catalog_section_2.`nSectionID`,
Catalog_section_1.`Section text`, Catalog_section_1.`nSectionID`, Catalog_section_1.`nParentSectionID`,
Catalog_section.`Section text`, Catalog_section.`nSectionID`, Catalog_section.`nParentSectionID`, Catalog_section.`bHideOnWebSite`,
Product.`Full description`, Product.`Price`, Product.`Can be ordered online`, Product.`bSuppressHtml`, Product.`nDuplicateIndex`, Product.`Short description`, Product.`sExtendedInfoImage`
FROM
(((`Catalog section` Catalog_section_3 RIGHT OUTER JOIN `Catalog section` Catalog_section_2 ON
Catalog_section_3.`nSectionID` = Catalog_section_2.`nParentSectionID`)
INNER JOIN `Catalog section` Catalog_section_1 ON
Catalog_section_2.`nSectionID` = Catalog_section_1.`nParentSectionID`)
INNER JOIN `Catalog section` Catalog_section ON
Catalog_section_1.`nSectionID` = Catalog_section.`nParentSectionID`)
INNER JOIN `Product` Product ON
Catalog_section.`nSectionID` = Product.`nParentSectionID`