SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8000R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148224

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8000RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142084

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8046R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148245

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8046RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148261

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8213RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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 `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8000' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 155135

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8000P' AND `Quantity` > 0 ORDER BY `Store` DESC

set names utf8

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

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8005'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8005'

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

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

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

set names utf8

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

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

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

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

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

set names utf8

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

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8005VALEO'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8005VALEO'

set names utf8

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

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8003'

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

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

set names utf8

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

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` = 182 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8005'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8005'

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

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

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

set names utf8

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

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` = 182 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

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` = 182 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

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

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

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

set names utf8

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

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` = 182 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8005VALEO'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8005VALEO'

set names utf8

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

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` = 182 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8005'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8005'

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

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT
                    *
                FROM
                    `groups`
                WHERE
                    `URLLabel` = 'starters' AND
                    `Language` = 'bg' AND
                    `Visible` = 1
                LIMIT 1

SELECT
                `parts`.`ID`,
                `parts`.`PostDate`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                CHAR_LENGTH(`parts`.`Gallery`) AS `IsGallery`,
                `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
                (`SubGroup`.`ID` = 1 OR `ParentGroup`.`ID` = 1) AND
                `part-texts`.`Language` = 'bg'
                
            GROUP BY
                `parts`.`ID`
            ORDER BY
                `IsGallery` DESC,
                `parts`.IsPromo ASC,
                `ParentGroup`.`URLLabel` ASC,
                `parts`.RefNumber ASC
         LIMIT 0, 12

SELECT COUNT(*) AS NumRows FROM (
            SELECT
                `parts`.`ID`,
                `parts`.`PostDate`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                CHAR_LENGTH(`parts`.`Gallery`) AS `IsGallery`,
                `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
                (`SubGroup`.`ID` = 1 OR `ParentGroup`.`ID` = 1) AND
                `part-texts`.`Language` = 'bg'
                
            GROUP BY
                `parts`.`ID`
            ORDER BY
                `IsGallery` DESC,
                `parts`.IsPromo ASC,
                `ParentGroup`.`URLLabel` ASC,
                `parts`.RefNumber ASC
        ) 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
                `ID`
            FROM
                `groups`
            WHERE
                `URLLabel` = 'starters' AND
                `Language` = 'bg' AND
                `Visible` = 1
            LIMIT 1

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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1852

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'EUR'
             AND `Visible` = 1 LIMIT 1

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142528

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1854

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142427

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142250

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8038R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1888

set names utf8

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

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

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

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8039' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148241

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8039RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 120023

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8064' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148223

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8072RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1932

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8083' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 2190

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8341' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 2223

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8374' AND `Quantity` > 0 ORDER BY `Store` DESC

set names utf8

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

SELECT
                    *
                FROM
                    `groups`
                WHERE
                    `URLLabel` = 'starters' AND
                    `Language` = 'bg' AND
                    `Visible` = 1
                LIMIT 1

SELECT
                `parts`.`ID`,
                `parts`.`PostDate`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                CHAR_LENGTH(`parts`.`Gallery`) AS `IsGallery`,
                `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
                (`SubGroup`.`ID` = 1 OR `ParentGroup`.`ID` = 1) AND
                `part-texts`.`Language` = 'bg'
                
            GROUP BY
                `parts`.`ID`
            ORDER BY
                `IsGallery` DESC,
                `parts`.IsPromo ASC,
                `ParentGroup`.`URLLabel` ASC,
                `parts`.RefNumber ASC
         LIMIT 0, 12

SELECT COUNT(*) AS NumRows FROM (
            SELECT
                `parts`.`ID`,
                `parts`.`PostDate`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                `parts`.`RefNumber`,
                `parts`.`Label`,
                `part-texts`.`Title`,
                `part-texts`.`URLLabel`,
                `parts`.`Gallery`,
                CHAR_LENGTH(`parts`.`Gallery`) AS `IsGallery`,
                `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
                (`SubGroup`.`ID` = 1 OR `ParentGroup`.`ID` = 1) AND
                `part-texts`.`Language` = 'bg'
                
            GROUP BY
                `parts`.`ID`
            ORDER BY
                `IsGallery` DESC,
                `parts`.IsPromo ASC,
                `ParentGroup`.`URLLabel` ASC,
                `parts`.RefNumber ASC
        ) 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
                `ID`
            FROM
                `groups`
            WHERE
                `URLLabel` = 'starters' AND
                `Language` = 'bg' AND
                `Visible` = 1
            LIMIT 1

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

set names utf8

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

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

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

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

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1852

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

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'EUR'
             AND `Visible` = 1 LIMIT 1

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142528

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1854

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142427

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142250

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8038R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1888

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8039' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148241

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8039RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 120023

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8064' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 148223

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8072RP' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 1932

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8083' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 2190

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8341' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 2223

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8374' AND `Quantity` > 0 ORDER BY `Store` DESC

set names utf8

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

SELECT
                    *
                FROM
                    `groups`
                WHERE
                    `URLLabel` = 'starters' AND
                    `Language` = 'bg' AND
                    `Visible` = 1
                LIMIT 1

SELECT
                `parts`.*,
                `part-texts`.*,
                IF(`ParentGroup`.`URLLabel` IS NULL, `SubGroup`.`URLLabel`, '') AS `ParentGroupUrlLabel`
            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`.`ID` = 142250 AND
                `part-texts`.`Language` = 'bg'
            LIMIT 1

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` = 142250 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT
                GROUP_CONCAT(`groups`.`MenuLabel` SEPARATOR ', ') AS `Groups`
            FROM
                `groups`
                INNER JOIN `part-groups` ON `part-groups`.`GroupID` = `groups`.`ID`
                INNER JOIN `parts` ON `parts`.`ID` = `part-groups`.`PartID`
            WHERE
                `parts`.`ID` = 142250 AND
                `groups`.`Language` = 'bg'
            GROUP BY
                `parts`.`ID`

SELECT
                `ParamID`,
                `Parameter`,
                `ParamValue`
            FROM
                `part-params`
                INNER JOIN `params` ON `params`.`ID` = `part-params`.`ParamID`
            WHERE
                `params`.`ID` < 1000 AND
                `PartID` = 142250 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` = 142250 AND
                `Language` = 'bg'
            ORDER BY
                `Parameter` ASC

SELECT DISTINCT
                    `parts`.`RefNumber`,
                    `brands`.`ID`,
                    `brands`.`Title`,
                    `part-brands`.`BrandNumber`,
                    `part-brands`.`BrandNumberSearch`,
                    `applications`.`BrandNumberSearch` AS `OrgNumber`,
                    `brands`.`PartVisible`
                FROM
                    `part-brands`
                    INNER JOIN `brands` ON `part-brands`.`Brand` = `brands`.`Title`
                    INNER JOIN `parts` ON `part-brands`.`RefNumber` = `parts`.`RefNumber`
                    LEFT JOIN `applications` ON `applications`.`BrandNumberSearch` = `part-brands`.`BrandNumberSearch`
                WHERE
                    `parts`.`ID` = 142250 
                ORDER BY
                    `brands`.`Title`,
                    `part-brands`.`BrandNumber`

SELECT DISTINCT
                `parts`.`RefNumber`,
                `brands`.`ID`,
                 UPPER(`applications`.`Brand`) AS `Title`,
                `applications`.`BrandNumber`,
                `applications`.`BrandNumberSearch`,
                `part-brands`.`BrandNumberSearch` AS `PartsNumber`,
                `brands`.`PartVisible`
            FROM
                `applications`
                INNER JOIN `brands` ON `applications`.`Brand` = `brands`.`Title`
                INNER JOIN `parts` ON `applications`.`RefNumber` = `parts`.`RefNumber`
                LEFT JOIN `part-brands` ON `applications`.`BrandNumberSearch` = `part-brands`.`BrandNumberSearch`
            WHERE
                `parts`.`ID` = 142250 
            GROUP BY
                `applications`.`BrandNumber`
            ORDER BY
                `applications`.`Brand`,
                `applications`.`BrandNumber`

SELECT DISTINCT
                `Marque`,
                `ModelName`,
                `ModelType`,
                `Carburant`,
                `Engine`,
                `DateDebut`,
                `DateFin`,
                `TypeID`
            FROM
                `vehicles`
                INNER JOIN `parts` ON `vehicles`.`RefNumber` = `parts`.`RefNumber`
            WHERE
                `parts`.`ID` = 142250
            ORDER BY
                `Marque`, `ModelName`

SELECT
                `equivalents`.*,
                `parts`.`ID` AS `PartID`,
                `part-texts`.`URLLabel` AS `PartURLLabel`,
                `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                `SubGroup`.`URLLabel` AS `GroupUrlLabel`
            FROM
                `equivalents`
                INNER JOIN `parts` ON `equivalents`.`EquivalentNumber` = `parts`.`RefNumber`
                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
                `part-texts`.`Language` = 'bg' AND
                `equivalents`.`Language` = 'bg' AND
                `equivalents`.`RefNumber` = 'IR8038R'
            GROUP BY `parts`.`ID`

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
                `ID`
            FROM
                `groups`
            WHERE
                `URLLabel` = 'starters' AND
                `Language` = 'bg' AND
                `Visible` = 1
            LIMIT 1

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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 142250

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8038R' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'EUR'
             AND `Visible` = 1 LIMIT 1

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 130121

set names utf8

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

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

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

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8128' AND `Quantity` > 0 ORDER BY `Store` DESC

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `parts`.`PriceGroup`,
                    `parts`.`MinQuantity`,
                    `parts`.`DeliveryDate`,
                    `parts`.`Orange`,
                    `parts`.`QtyOrder`
                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` = 2233

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8384' AND `Quantity` > 0 ORDER BY `Store` DESC

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir80%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8097' LIMIT 1

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8097'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8097'

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

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

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

set names utf8

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

(
                    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 'MONEA IR8%'
                    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 'MONEA IR8%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    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 'MONEA IR80%'
                    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 'MONEA IR80%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    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 'MONEA%'
                    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 'MONEA%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8003%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8003' LIMIT 1

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8003'

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006R' LIMIT 1

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` = 142427 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

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

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

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8003%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8003P' LIMIT 1

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` = 140988 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8003P'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8003P'

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

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

(
                    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 'MONEA IR8003%'
                    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 'MONEA IR8003%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    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 'MONEA IR8003%'
                    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 'MONEA IR8003%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    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 'MONEA IR800%'
                    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 'MONEA IR800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8003%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8003' LIMIT 1

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` = 1852 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8003'

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8-0%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
        ) 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         AND `SearchKey` LIKE '%w5t8wqDCrsObecKYwpzDmsKiwpTDn8OMwqfCs8%' LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
         AND `SearchKey` LIKE '%w5t8wqDCrsObecKYwpzDmsKiwpTDn8OMwqfCs8%') 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1033
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1033
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
        ) 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         AND `SearchKey` LIKE '%w5h9wpTCpMOaZ8Kow%' LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
         AND `SearchKey` LIKE '%w5h9wpTCpMOaZ8Kow%') 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 109
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

(
                    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 'MONEA IR8002%'
                    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 'MONEA IR8002%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    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 'MONEA IR8002%'
                    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 'MONEA IR8002%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
        ) 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         AND `SearchKey` LIKE '%w5h9wpTCpMOaZ8Kow%' LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
         AND `SearchKey` LIKE '%w5h9wpTCpMOaZ8Kow%') 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 109
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

SELECT * FROM `user-price-groups` WHERE `UserID` = 109

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

SELECT DISTINCT `Brand` FROM `part-brands` WHERE 1

SELECT `ID`, `ListName` FROM `pricelist` WHERE `ID` != 687

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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 109
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006R' LIMIT 1

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` = 142427 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

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

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

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006R' LIMIT 1

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` = 142427 AND
                    `users`.`ID` = 109
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8006R'

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

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

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

SELECT * FROM `user-price-groups` WHERE `UserID` = 1030

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

SELECT DISTINCT `Brand` FROM `part-brands` WHERE 1

SELECT `ID`, `ListName` FROM `pricelist` WHERE `ID` != 687

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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

SELECT
                *
            FROM
                `users`
            WHERE 1
         LIMIT 0, 30

SELECT COUNT(*) AS NumRows FROM (SELECT
                *
            FROM
                `users`
            WHERE 1
        ) 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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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

set names utf8

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

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

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

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

SELECT
                *
            FROM
                `orders`
            WHERE
                `Status` > 0 AND
                `UserID` = 1030
            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` = 1030 AND
                            `UserKey` LIKE '%2'
                        LIMIT 1

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

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

(
                    SELECT
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir800%'
                    ORDER BY `parts`.`Gallery` DESC
                    LIMIT 10
                )
            

            UNION

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8002' LIMIT 1

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` = 120000 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

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

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 3
            WHERE
                `parts`.`RefNumber` = 'IR8002'

SELECT
                `prices`.`Price`,
                `parts`.`PriceGroup`
            FROM
                `parts`
                LEFT JOIN `prices` ON
                    `prices`.`RefNumber` = `parts`.`RefNumber` AND
                    `prices`.`PriceListID` = 711
            WHERE
                `parts`.`RefNumber` = 'IR8002'

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

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

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