
set names utf8

SELECT
                    `ID`,
                    `MetaTitle`,
                    `MetaDescription`,
                    `MetaKeywords`,
                    `MetaImage`
                FROM
                    `nav`
                WHERE
                    `Language` = 'bg' AND
                    (`URLLabel` IS NULL OR `URLLabel` = '')
                LIMIT 1

SELECT
                *
            FROM
                `slider`
            WHERE
                (CURDATE() BETWEEN `StartFrom` AND `EndTo` OR `EndTo` IS NULL) AND
                `Language` = 'bg' AND
                `Visible` = 1
            ORDER BY
                `PostDate` DESC
            LIMIT 6

SELECT
                `ID`,
                `PostDate`,
                `Title`,
                `URLLabel`,
                `Annotation`,
                `FilePath`,
                `Visible`
	        FROM
	        	`events`
	    	WHERE
                `Language` = 'bg' AND
                `OnFirstPage` = 1
         AND `Visible` = 1 ORDER BY `PostDate` DESC LIMIT 4

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC

set names utf8

SELECT
                `parts`.`ID`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                `parts`.`Visible`
            FROM
                `parts`
                INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
            WHERE
                `parts`.`IsNew` = 1 AND
                `parts`.`Visible` = 1 AND
                `parts`.`PostDate` > DATE_SUB(NOW(), INTERVAL 1 MONTH) AND /* TODO 12 -> 1 */
                `part-texts`.`Language` = 'bg'
            GROUP BY `parts`.`ID`
         ORDER BY RAND() LIMIT 8

set names utf8

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                        LEFT JOIN `part-brands` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `parts`.`RefNumber` LIKE '1000304614902%' OR
                        `parts`.`Barcode` LIKE '1000304614902%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )

                UNION

                (
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `part-brands`.`BrandNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `part-brands`
                        INNER JOIN `parts` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `part-brands`.`BrandNumberSearch` LIKE '1000304614902%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
             LIMIT 10

set names utf8

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                        LEFT JOIN `part-brands` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `parts`.`RefNumber` LIKE '1000304614902%' OR
                        `parts`.`Barcode` LIKE '1000304614902%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )

                UNION

                (
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `part-brands`.`BrandNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `part-brands`
                        INNER JOIN `parts` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `part-brands`.`BrandNumberSearch` LIKE '1000304614902%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
             LIMIT 10

set names utf8

SELECT `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'IR6149P%'

SELECT `RefNumber`, `Brand`, `BrandNumber` FROM `part-brands` WHERE `BrandNumberSearch` LIKE 'IR6149P%'

SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    `parts`.`Visible` = 1 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR6149P')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = 'IR6149P' THEN 0
                        WHEN `parts`.`RefNumber` LIKE 'IR6149P%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
             LIMIT 0, 12

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` < 1000 AND
                `PartID` = 1 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` > 1000 AND
                `PartID` = 1 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT COUNT(*) AS NumRows FROM (
                SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    `parts`.`Visible` = 1 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR6149P')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = 'IR6149P' THEN 0
                        WHEN `parts`.`RefNumber` LIKE 'IR6149P%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
            ) AS CountTable

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC

set names utf8

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                        LEFT JOIN `part-brands` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `parts`.`RefNumber` LIKE '1000304614902%' OR
                        `parts`.`Barcode` LIKE '1000304614902%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )

                UNION

                (
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `part-brands`.`BrandNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `part-brands`
                        INNER JOIN `parts` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `part-brands`.`BrandNumberSearch` LIKE '1000304614902%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
             LIMIT 10

set names utf8

SELECT `RefNumber` FROM `parts` WHERE `RefNumber` LIKE '1000304614902%' OR `Barcode` LIKE '1000304614902%'

SELECT `RefNumber`, `Brand`, `BrandNumber` FROM `part-brands` WHERE `BrandNumberSearch` LIKE '1000304614902%'

SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    `parts`.`Visible` = 1 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR6149P')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = '1000304614902' THEN 0
                        WHEN `parts`.`RefNumber` LIKE '1000304614902%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
             LIMIT 0, 12

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` < 1000 AND
                `PartID` = 1 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` > 1000 AND
                `PartID` = 1 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT COUNT(*) AS NumRows FROM (
                SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    `parts`.`Visible` = 1 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR6149P')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = '1000304614902' THEN 0
                        WHEN `parts`.`RefNumber` LIKE '1000304614902%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
            ) AS CountTable

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC

set names utf8

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                        LEFT JOIN `part-brands` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `parts`.`RefNumber` LIKE '10003046149%' OR
                        `parts`.`Barcode` LIKE '10003046149%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )

                UNION

                (
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        `part-brands`.`Brand`,
                        `part-brands`.`BrandNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `part-brands`
                        INNER JOIN `parts` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    WHERE
                        `part-brands`.`BrandNumberSearch` LIKE '10003046149%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
             LIMIT 10

set names utf8

SELECT `RefNumber` FROM `parts` WHERE `RefNumber` LIKE '10003046149%' OR `Barcode` LIKE '10003046149%'

SELECT `RefNumber`, `Brand`, `BrandNumber` FROM `part-brands` WHERE `BrandNumberSearch` LIKE '10003046149%'

SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    `parts`.`Visible` = 1 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR6149P')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = '10003046149' THEN 0
                        WHEN `parts`.`RefNumber` LIKE '10003046149%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
             LIMIT 0, 12

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` < 1000 AND
                `PartID` = 1 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` > 1000 AND
                `PartID` = 1 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT COUNT(*) AS NumRows FROM (
                SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    `parts`.`Visible` = 1 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR6149P')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = '10003046149' THEN 0
                        WHEN `parts`.`RefNumber` LIKE '10003046149%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
            ) AS CountTable

SELECT `CharCode` FROM `currencies`  WHERE `Visible` = 1

SELECT
                *
	        FROM
	        	`rollingnews`
	    	WHERE
                (CURDATE() BETWEEN FromDate AND ToDate OR ToDate = '0000-00-00') AND
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`PostDate` DESC
            LIMIT 4

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
                `ID`,
	        	`MenuLabel`,
	        	`URLLabel`
	        FROM
	        	`nav`
	    	WHERE
                `Language` = 'bg' AND
	    		`Visible` = 1
            ORDER BY
            	`ItemPosition` ASC

SELECT
                `groups`.`ID`,
                `groups`.`ParentID`,
	        	`groups`.`MenuLabel`,
	        	`groups`.`URLLabel`,
                `groups`.`PartsLabel`,
                `SubGroups`.`ID` AS `SubGroupID`,
                `groups`.`Visible`
	        FROM
	        	`groups`
                LEFT JOIN `groups` AS `SubGroups` ON `groups`.`ID` = `SubGroups`.`ParentID`
	    	WHERE
                `groups`.`Language` = 'bg' AND
	    		`groups`.`Visible` = 1
            GROUP BY
                `groups`.`ID`
            ORDER BY
                `groups`.`ParentID` ASC,
            	`groups`.`ItemPosition` ASC,
                `groups`.`MenuLabel` ASC

SELECT
	        	`pages`.`MenuLabel`,
	        	`pages`.`URLLabel`,
                `pages`.`Visible`
	        FROM
	        	`pages`
	    	WHERE
                `pages`.`Language` = 'bg' AND
	    		`pages`.`Visible` = 1 AND
                `pages`.`InFooter` = 1
            ORDER BY
            	`pages`.`ItemPosition` ASC,
                `pages`.`MenuLabel` ASC
