En SEARCH TREE2.sql

Материал из MstarProject Manual
Перейти к: навигация, поиск

/* Display of the list of non-original products for a given type of vehicle (TYP_ID) and category (STR_ID) */

/* It is usually executed, when there are no matches in the previous query, i.e. the selected branch of categories */

/* contains no subcategories, though it can be executed at any tree level as well - in this case */

/* the products for a given vehicle from all subcategories at any nesting level of the selected category will be displayed. */

SET @TYP_ID = 3822; /* ALFA ROMEO 145 (930) 1.4 i.e. [1994/07-1996/12] */
SET @STR_ID = 10630; /* Piston assembly; You can use NULL to display ALL spare parts of the car */
SELECT	LA_ART_ID
FROM	           LINK_GA_STR
INNER JOIN LINK_LA_TYP ON LAT_TYP_ID = @TYP_ID AND	                          LAT_GA_ID = LGS_GA_ID
INNER JOIN LINK_ART ON LA_ID = LAT_LA_ID
WHERE	LGS_STR_ID <=> @STR_ID
ORDER BY	LA_ART_ID
LIMIT	100;