
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 `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 `ID`, `UserKey` FROM `users` WHERE `UserKey` LIKE 'w5vClsOAwpXDqcKnw4HCncK3w5fCsMOLw5zCu8KTw5rCpcKx%' LIMIT 1

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 33 LIMIT 1

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

SELECT `Num` FROM `basket` WHERE `UserID` = 33

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 33 LIMIT 1

SELECT
                `ListName`
            FROM
                `pricelist`
            WHERE
                `ID` = 3
            LIMIT 1

SELECT `GroupID`, `PriceCorrection` FROM `user-price-groups` WHERE `UserID` = 33

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 33
            ORDER BY
                `PostDate` DESC
            LIMIT 100

SELECT `CharCode` FROM `currencies`

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
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 33 LIMIT 1

SELECT `Num` FROM `basket` WHERE `UserID` = 33

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT
                `orders`.*,
                `users`.`Data` AS `UserData`,
                RIGHT(`UserKey`, 1) AS `Access`
            FROM
                `orders`
                LEFT JOIN `users` ON `orders`.`UserID` = `users`.`ID`
            WHERE
                `orders`.`Status` > 0
         ORDER BY `orders`.`LastUpdate` DESC LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                `orders`.*,
                `users`.`Data` AS `UserData`,
                RIGHT(`UserKey`, 1) AS `Access`
            FROM
                `orders`
                LEFT JOIN `users` ON `orders`.`UserID` = `users`.`ID`
            WHERE
                `orders`.`Status` > 0
         ORDER BY `orders`.`LastUpdate` DESC) AS CountTable

SELECT `CharCode` FROM `currencies`

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
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 33 LIMIT 1

SELECT `Num` FROM `basket` WHERE `UserID` = 33

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `Code`, `Name` FROM `countries` ORDER BY `countries`.`Name` ASC

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `Code`, `Name` FROM `countries` ORDER BY `countries`.`Name` ASC

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT
                    `ID`,
                    `UserKey`,
                    `Data`
                FROM
                    `users`
                WHERE
                    `users`.`SearchKey` LIKE '%w5h9wpTC%'
                ORDER BY
                    CASE
                        WHEN `users`.`SearchKey` LIKE 'w5h9wpTC%' THEN 0
                        ELSE 1
                    END
                LIMIT 20

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 109 LIMIT 1

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `ID`, `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'ir8%' LIMIT 20

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `ID`, `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'ir80%' LIMIT 20

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `PriceListID` FROM `users` WHERE `ID` = 109 LIMIT 1

SELECT `GroupID`, `PriceCorrection` FROM `user-price-groups` WHERE `UserID` = 109

SELECT
                    `Exchange`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
                LIMIT 1

SELECT
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`
                FROM
                    `parts`
                    LEFT JOIN `prices` AS `GPL` ON
                        `GPL`.`RefNumber` = `parts`.`RefNumber` AND
                        `GPL`.`PriceListID` = 711
                    LEFT JOIN `prices` AS `UPL` ON
                        `UPL`.`RefNumber` = `parts`.`RefNumber` AND
                        `UPL`.`PriceListID` = 3
                WHERE
                    `parts`.`ID` = 1849

SELECT GROUP_CONCAT(`BrandNumber` SEPARATOR ', ') AS `Numbers`
            FROM (
                SELECT
                    `part-brands`.`BrandNumber`
                FROM
                    `users`
                    INNER JOIN `part-brands` ON `users`.`Brand` = `part-brands`.`Brand`
                    INNER JOIN `parts` ON `parts`.`RefNumber` = `part-brands`.`RefNumber`
                WHERE
                    `parts`.`ID` = 1849 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `ID`, `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'ir8%' LIMIT 20

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT `PriceListID` FROM `users` WHERE `ID` = 109 LIMIT 1

SELECT `GroupID`, `PriceCorrection` FROM `user-price-groups` WHERE `UserID` = 109

SELECT
                    `Exchange`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
                LIMIT 1

SELECT
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`
                FROM
                    `parts`
                    LEFT JOIN `prices` AS `GPL` ON
                        `GPL`.`RefNumber` = `parts`.`RefNumber` AND
                        `GPL`.`PriceListID` = 711
                    LEFT JOIN `prices` AS `UPL` ON
                        `UPL`.`RefNumber` = `parts`.`RefNumber` AND
                        `UPL`.`PriceListID` = 3
                WHERE
                    `parts`.`ID` = 1849

SELECT GROUP_CONCAT(`BrandNumber` SEPARATOR ', ') AS `Numbers`
            FROM (
                SELECT
                    `part-brands`.`BrandNumber`
                FROM
                    `users`
                    INNER JOIN `part-brands` ON `users`.`Brand` = `part-brands`.`Brand`
                    INNER JOIN `parts` ON `parts`.`RefNumber` = `part-brands`.`RefNumber`
                WHERE
                    `parts`.`ID` = 1849 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             LIMIT 1

SELECT `Name` FROM `countries` WHERE `Code` = 'BG' LIMIT 1

SELECT * FROM `orders` LIMIT 1

SHOW COLUMNS FROM `orders`

INSERT INTO `orders` SET `ClientOrderNumber` = '123', `PostDate` = '2024-12-11 07:55:47', `LastUpdate` = '2024-12-11 07:55:47', `UserID` = '109', `Basket` = '{"1849":[{"qty":1,"price":58.11,"number":"0001112007, 0986013850, 0986013851","note":""},{"qty":1,"price":80,"number":"0001112007, 0986013850, 0986013851","note":""}]}', `TotalPrice` = 138.11, `TotalWeight` = 0, `DeliveryPrice` = 0, `Currency` = 'BGN', `CurrencyPrice` = '138.11 лв.', `CurrencyExchange` = '1', `Status` = 7, `Admin` = 1, `DeliveryData` = 'iZu3XXwyQ6Ijge2tKtYt4GTXg_nT9NjcufD9O5-Fn-VadaeUlFUOmM64FQLltPP6_N8u4QlAhwzcqNKzNiwOHOivEk6pkcjIqil22-e_mXlLG-5EywRgdh1xZP-wGXFz-tJrhtGf5W9ZEeXrbU70htt6GKqNQIXg18xC0W1BZpVO1q9vNjiW-PGXB4u9qwQ099acmyZlJSnKDabicIN3uj3mZJKZ-inO-uUvLStTtiX_sqbcYa2zyLs3eOyrupgZUfWTmG-5056kJpcwCD_TKJvQN-E5wiaDEWXGS4sxfyJVPysR55kpUmv51JGsvJ66-Rk9OHNpCEidCTD0rfuEIxKt09z1Ca4qfIb9lp6sl9KN0-xh7tWoLTGHqhCZ7zkS7MmyJyJ4VQc_R0i-Fy4_HA', `InvoiceData` = 'c64UtOxanjB1yjZGNXaxvV0bFV9Mbs4X60n27MAr07yPYm-7_XgXAhO_qHbIekQoXiD0pANpnK9Bca55Eph-SUpRO2RA8gGxXS1wDpukuNZmAlW5FaowXk1nb_v7NhNLY9TiGGAJQpNZQ9bIsKgf7GeB4QBhBqFS1OasuFSuo8BdulWoPZUxw1YiQ7ZPJQavnEnP-OfcMFMU5hXIuAdJpo3CisvQTjsNj3fH2AXTHAuykPmpyhBJCaOZjnS0FMX7e0MoSX5OEeFn6mPPD3g-d8FSYyooiCw_L4sb4he0Cw0', `SearchKey` = 'wqfCjsKiwobDnsKCwplowqfDicKLwrzDmsODwqjCwqfCgcKewoXDqsKCwpnCrcKnwrzCh8K8w5rCncKswrlmwpDCtsK4w4LCw5h9wpTCpMOaZ8KowqrDiMK3dMOSw5jClsOJw7DCj8KcwobDlsKuwqbClsOsw4vCpMw4R5wrFow4XCiMKXZsOGwrTCkMKaw4HC'

SELECT
                `parts`.*,
                `part-texts`.*,
                `ParentGroup`.`Title` AS `ParentGroupName`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`Title` AS `SubGroupName`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `availabilities`.`Quantity`
            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'
                LEFT JOIN `availabilities` ON `availabilities`.`RefNumber` = `parts`.`RefNumber`
            WHERE
                `parts`.`ID` = 1849 AND
                `part-texts`.`Language` = 'bg'
            LIMIT 1

SELECT
                `orders`.*
            FROM
                `orders`
            WHERE
                `orders`.`ID` = 101 AND
                `orders`.`Status` > 0
            LIMIT 1

SELECT * FROM `users` WHERE `ID` = 109 LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             LIMIT 1

SELECT `GroupID`, `PriceCorrection` FROM `user-price-groups` WHERE `UserID` = 33

SELECT
                `parts`.*,
                `part-texts`.*,
                `ParentGroup`.`Title` AS `ParentGroupName`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`Title` AS `SubGroupName`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `availabilities`.`Quantity`
            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'
                LEFT JOIN `availabilities` ON `availabilities`.`RefNumber` = `parts`.`RefNumber`
            WHERE
                `parts`.`ID` = 1849 AND
                `part-texts`.`Language` = 'bg'
            LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             LIMIT 1

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT
                `orders`.*,
                `users`.`Data` AS `UserData`,
                RIGHT(`UserKey`, 1) AS `Access`
            FROM
                `orders`
                LEFT JOIN `users` ON `orders`.`UserID` = `users`.`ID`
            WHERE
                `orders`.`Status` > 0
         ORDER BY `orders`.`LastUpdate` DESC LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                `orders`.*,
                `users`.`Data` AS `UserData`,
                RIGHT(`UserKey`, 1) AS `Access`
            FROM
                `orders`
                LEFT JOIN `users` ON `orders`.`UserID` = `users`.`ID`
            WHERE
                `orders`.`Status` > 0
         ORDER BY `orders`.`LastUpdate` DESC) AS CountTable

SELECT `CharCode` FROM `currencies`

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
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 33 LIMIT 1

SELECT `Num` FROM `basket` WHERE `UserID` = 33

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT
                `orders`.*
            FROM
                `orders`
            WHERE
                `orders`.`ID` = 101 AND
                `orders`.`Status` > 0
            LIMIT 1

SELECT `CharCode` FROM `currencies`

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
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 33 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

SELECT * FROM `users` WHERE `ID` = 33 LIMIT 1

SELECT `Num` FROM `basket` WHERE `UserID` = 33
