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` = 148226

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 141848

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005VALEO' 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` = 143021

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 149838

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR9489R' 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` = 120314

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 100136

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 145596

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 100190

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 137092

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             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` = 143674

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'USD'
             AND `Visible` = 1 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Basket` FROM `basket` WHERE `UserID` = 1030 LIMIT 1

SELECT `MinQuantity` FROM `parts` WHERE `ID` = 1854

INSERT INTO  `basket`
                        (`UserID`, `PostDate`, `UpdateDate`, `Basket`, `Num`) VALUES
                        (1030, NOW(), NOW(), '{"1854":{"qty":1,"price":0,"note":"","number":"D6RA62, D6RA32, D6RA249"}}', 1)

set names utf8

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

SELECT `Basket` FROM `basket` WHERE `UserID` = 1030 LIMIT 1

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

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PriceGroup`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `ParentGroup`.`Title` AS `ParentGroupName`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`Title` AS `SubGroupName`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    -- `prices`.`Price` AS `UserPrice`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `availabilities`.`Quantity`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON
                        `SubGroup`.`ID` = `part-groups`.`GroupID` AND
                        `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON
                        `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND
                        `ParentGroup`.`Language` = 'bg'
                    LEFT JOIN `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
                    LEFT JOIN `availabilities` ON `availabilities`.`RefNumber` = `parts`.`RefNumber`
                WHERE
                    `parts`.`ID` = 1854 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`Visible` = 1
                LIMIT 1

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

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

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

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

SELECT `ID` FROM `orders` WHERE `UserID` = 1030 AND `Status` = 0 LIMIT 1

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` = 1854

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

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

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` = 141789

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005R' 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` = 148226

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005RP' 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` = 141848

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005VALEO' 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` = 143021

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005P' 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` = 149838

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR9489R' 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` = 120314

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR9489P' 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` = 100136

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IA2544' 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` = 145596

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IA2544ZEN' 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` = 100190

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IA2631' 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` = 137092

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IA2631BOSCH' 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` = 143674

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'EUR'
             AND `Visible` = 1 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Basket` FROM `basket` WHERE `UserID` = 1030 LIMIT 1

SELECT `MinQuantity` FROM `parts` WHERE `ID` = 1854

UPDATE
                            `basket`
                        SET
                            `UpdateDate` = NOW(),
                            `Basket` = '{"1854":{"qty":1,"price":0,"note":"","number":"D6RA62, D6RA32, D6RA249"}}',
                            `Num` = 1
                        WHERE
                            `UserID` = 1030 LIMIT 1

set names utf8

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

SELECT `Basket` FROM `basket` WHERE `UserID` = 1030 LIMIT 1

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

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PriceGroup`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `ParentGroup`.`Title` AS `ParentGroupName`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`Title` AS `SubGroupName`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    -- `prices`.`Price` AS `UserPrice`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `availabilities`.`Quantity`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON
                        `SubGroup`.`ID` = `part-groups`.`GroupID` AND
                        `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON
                        `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND
                        `ParentGroup`.`Language` = 'bg'
                    LEFT JOIN `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
                    LEFT JOIN `availabilities` ON `availabilities`.`RefNumber` = `parts`.`RefNumber`
                WHERE
                    `parts`.`ID` = 1854 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`Visible` = 1
                LIMIT 1

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

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

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

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

SELECT `ID` FROM `orders` WHERE `UserID` = 1030 AND `Status` = 0 LIMIT 1

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` = 1854

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

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 141789

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148226

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 141848

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005VALEO' 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` = 143021

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 149838

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR9489R' 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` = 120314

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 100136

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 145596

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 100190

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 137092

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 143674

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             AND `Visible` = 1 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Basket` FROM `basket` WHERE `UserID` = 1030 LIMIT 1

SELECT `MinQuantity` FROM `parts` WHERE `ID` = 1854

UPDATE
                            `basket`
                        SET
                            `UpdateDate` = NOW(),
                            `Basket` = '{"1854":{"qty":1,"price":0,"note":"","number":"D6RA62, D6RA32, D6RA249"}}',
                            `Num` = 1
                        WHERE
                            `UserID` = 1030 LIMIT 1

set names utf8

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

SELECT `Basket` FROM `basket` WHERE `UserID` = 1030 LIMIT 1

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

SELECT
                    `parts`.`ID`,
                    `parts`.`RefNumber`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PriceGroup`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `ParentGroup`.`Title` AS `ParentGroupName`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`Title` AS `SubGroupName`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    -- `prices`.`Price` AS `UserPrice`,
                    `GPL`.`Price` AS `Price`,
                    `UPL`.`Price` AS `UserPrice`,
                    `availabilities`.`Quantity`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON
                        `SubGroup`.`ID` = `part-groups`.`GroupID` AND
                        `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON
                        `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND
                        `ParentGroup`.`Language` = 'bg'
                    LEFT JOIN `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
                    LEFT JOIN `availabilities` ON `availabilities`.`RefNumber` = `parts`.`RefNumber`
                WHERE
                    `parts`.`ID` = 1854 AND
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`Visible` = 1
                LIMIT 1

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

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

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

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

SELECT `ID` FROM `orders` WHERE `UserID` = 1030 AND `Status` = 0 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` = 'IR8005' 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8003RP' 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` = 148225 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003RP' AND `Store` = 'BLG'

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` = 'IR8003RP'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8005P' 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` = 143021 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005P' AND `Store` = 'BLG'

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` = 'IR8005P'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8002' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8005' 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8002' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8005VALEO' 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` = 141848 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005VALEO' AND `Store` = 'BLG'

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 `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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8002' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8002' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8005' 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003P' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8003R' 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` = 142528 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003R' AND `Store` = 'BLG'

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` = 'IR8003R'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8003' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8005P' 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` = 143021 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005P' AND `Store` = 'BLG'

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` = 'IR8005P'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8005' 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` = 1854 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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
                    *
                FROM
                    `groups`
                WHERE
                    `URLLabel` = 'madeinmonea' 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` = 2000 OR `ParentGroup`.`ID` = 2000) 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` = 2000 OR `ParentGroup`.`ID` = 2000) 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` = 'madeinmonea' 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` = 144968

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

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 152970

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148241

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148223

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148312

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 155945

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 156417

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148201

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 153414

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 156520

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148514

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 157812

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             AND `Visible` = 1 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 `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
                    `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` = 'BGN'
             AND `Visible` = 1 LIMIT 1

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 1854

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 142427

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 142250

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 1888

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148241

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 120023

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148223

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 1932

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 2190

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 2223

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             AND `Visible` = 1 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 `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 `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'IR8005%'

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

SELECT `RefNumber`, `Brand`, `BrandNumber` FROM `applications` WHERE `BrandNumberSearch` LIKE 'IR8005%'

SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR8005','IR8005P','IR8005R','IR8005RP','IR8005VALEO','IR9489P','IR9489R','IA1670','IA1689','IA1700','IA1765','IA1801','IA1815','IA1815P','IA1858','IA1904','IA1909','IA1929','IA2544','IA2544ZEN','IA2631','IA2631BOSCH','IA2631ZEN','IA2686','IA2686ZEN','IA3142','IA3142BOSCH','IA3142P','IA3166','IA3166BOSCH','IA3544','IA3545','IA3545IKA','IA3603','IA3603IKA','IA3643','IA5000','IA5001','IA5001P','IA5002','IA5003','IA5005','IA5005IKA','IA5022','IA5024','IA5030BOSCH','IA5032BOSCH','IA5034','IA5050','IA5055','IA5056','IA5056P','IA5057','IA5087','IA5111','IA5281','IA5514','IA5608','IA5608IKA','IA5608P','IA5612','IA5612IKA','IA5612P','IA5618','IA5618IKA','IA5619','IA5619IKA','IA5619P','IA5641','IA5641IKA','IA5641P','IA5643','IA5643IKA','IA5643P','IA5645','IA5645IKA','IA5645P','IA5646','IA5646IKA','IA5646P','IA5655','IA5655IKA','IA5667','IA5667IKA','IA5699','IA6552','IA6552BOSCH','IA6552IKA','IA6649','IA6649IKA','IA6784','IA6784IKA','IA9110','IA9110F','IA9110G','IA9110P','IA9110VALEO','IA9110ZB','IA9691','IA9691BOSCH','IA9692BOSCH','IA9802','IA9802ZB','IA9820','IA9820ZB','IA9824','IA9824P','IA9824ZB','IA9831ZB','IA9843','IB5049','IB5468')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = 'IR8005' THEN 0
                        WHEN `parts`.`RefNumber` LIKE 'IR8005%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
             LIMIT 0, 12

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

SELECT COUNT(*) AS NumRows FROM (
                SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR8005','IR8005P','IR8005R','IR8005RP','IR8005VALEO','IR9489P','IR9489R','IA1670','IA1689','IA1700','IA1765','IA1801','IA1815','IA1815P','IA1858','IA1904','IA1909','IA1929','IA2544','IA2544ZEN','IA2631','IA2631BOSCH','IA2631ZEN','IA2686','IA2686ZEN','IA3142','IA3142BOSCH','IA3142P','IA3166','IA3166BOSCH','IA3544','IA3545','IA3545IKA','IA3603','IA3603IKA','IA3643','IA5000','IA5001','IA5001P','IA5002','IA5003','IA5005','IA5005IKA','IA5022','IA5024','IA5030BOSCH','IA5032BOSCH','IA5034','IA5050','IA5055','IA5056','IA5056P','IA5057','IA5087','IA5111','IA5281','IA5514','IA5608','IA5608IKA','IA5608P','IA5612','IA5612IKA','IA5612P','IA5618','IA5618IKA','IA5619','IA5619IKA','IA5619P','IA5641','IA5641IKA','IA5641P','IA5643','IA5643IKA','IA5643P','IA5645','IA5645IKA','IA5645P','IA5646','IA5646IKA','IA5646P','IA5655','IA5655IKA','IA5667','IA5667IKA','IA5699','IA6552','IA6552BOSCH','IA6552IKA','IA6649','IA6649IKA','IA6784','IA6784IKA','IA9110','IA9110F','IA9110G','IA9110P','IA9110VALEO','IA9110ZB','IA9691','IA9691BOSCH','IA9692BOSCH','IA9802','IA9802ZB','IA9820','IA9820ZB','IA9824','IA9824P','IA9824ZB','IA9831ZB','IA9843','IB5049','IB5468')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = 'IR8005' THEN 0
                        WHEN `parts`.`RefNumber` LIKE 'IR8005%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
            ) 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 `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` = 1854

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

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 141789

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             AND `Visible` = 1 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`,
                    `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` = 148226

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

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

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 141848

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8005VALEO' 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` = 143021

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 149838

SELECT `Store`, `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR9489R' 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` = 120314

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 100136

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 145596

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 100190

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 137092

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 143674

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             AND `Visible` = 1 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`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8005%'
                    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 'ir8005%'
                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 'ir8006%'
                    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 'ir8006%'
                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` = '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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 IR8006%'
                    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 IR8006%'
                    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 IR8006%'
                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 `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'MONEAIR8006%'

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

SELECT `RefNumber`, `Brand`, `BrandNumber` FROM `applications` WHERE `BrandNumberSearch` LIKE 'MONEAIR8006%'

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 'ir8006%'
                    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 'ir8006%'
                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 `RefNumber` FROM `parts` WHERE `RefNumber` LIKE 'IR8006R%'

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

SELECT `RefNumber`, `Brand`, `BrandNumber` FROM `applications` WHERE `BrandNumberSearch` LIKE 'IR8006R%'

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

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

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

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

SELECT COUNT(*) AS NumRows FROM (
                SELECT
                    `parts`.`ID`,
                    `parts`.`PostDate`,
                    `ParentGroup`.`URLLabel` AS `ParentGroupUrlLabel`,
                    `SubGroup`.`URLLabel` AS `GroupUrlLabel`,
                    `parts`.`RefNumber`,
                    `parts`.`Label`,
                    `parts`.`Barcode`,
                    `part-texts`.`Title`,
                    `part-texts`.`URLLabel`,
                    `parts`.`Gallery`,
                    `parts`.`PartType`,
                    `parts`.`Connecteur`,
                    `parts`.`Weight`,
                    `parts`.`MinQuantity`,
                    `parts`.`IsPromo`,
                    `parts`.`IsNew`,
                    `parts`.`Visible`
                FROM
                    `parts`
                    INNER JOIN `part-texts` ON `parts`.`ID` = `part-texts`.`PartID`
                    INNER JOIN `part-groups` ON `parts`.`ID` = `part-groups`.`PartID`
                    INNER JOIN `groups` AS `SubGroup` ON `SubGroup`.`ID` = `part-groups`.`GroupID` AND `SubGroup`.`Language` = 'bg'
                    LEFT JOIN `groups` AS `ParentGroup` ON `ParentGroup`.`ID` = `SubGroup`.`ParentID` AND `ParentGroup`.`Language` = 'bg'
                WHERE
                    
                    `part-texts`.`Language` = 'bg' AND
                    `parts`.`RefNumber` IN ('IR8006R','IR8006RP')
                GROUP BY
                    `parts`.`ID`
                ORDER BY
                    CASE
                        WHEN `parts`.`RefNumber` = 'IR8006R' THEN 0
                        WHEN `parts`.`RefNumber` LIKE 'IR8006R%' THEN 1
                        ELSE 2
                    END,
                    `SubGroup`.`ParentID`,
                    `part-texts`.`Title`
            ) 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 `GroupID`, `PriceCorrection` FROM `user-price-groups` 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 `Num` FROM `basket` 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` = 142427

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

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

SELECT
                    `Exchange`,
                    `Label`,
                    `FixPosition`
                FROM
                    `currencies`
                WHERE
                    `CharCode` = 'BGN'
             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` = 148227

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

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

set names utf8

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

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

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

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

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

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

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

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

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

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

set names utf8

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

set names utf8

SELECT
                            `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 IR8006R%'
                    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 IR8006R%'
                    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 IR8006R%'
                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 IR8006%'
                    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 IR8006%'
                    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 IR8006%'
                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 '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
                        `parts`.`ID` AS `PartID`,
                        `parts`.`RefNumber`,
                        'MONEA' AS `Brand`,
                        `parts`.`RefNumber` AS `Number`,
                        `parts`.`Gallery`
                    FROM
                        `parts`
                    WHERE
                        `parts`.`RefNumber` LIKE 'ir8006%'
                    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 'ir8006%'
                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` = 'IR8006' 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` = 1855 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006' AND `Store` = 'BLG'

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` = 'IR8006'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006P' 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` = 144843 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006P' AND `Store` = 'BLG'

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` = 'IR8006P'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006RP' 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` = 148227 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006RP' AND `Store` = 'BLG'

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` = 'IR8006RP'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006' 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` = 1855 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006' AND `Store` = 'BLG'

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` = 'IR8006'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006' 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` = 1855 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006' AND `Store` = 'BLG'

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` = 'IR8006'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006P' 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` = 144843 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006P' AND `Store` = 'BLG'

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` = 'IR8006P'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006' 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` = 1855 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006' AND `Store` = 'BLG'

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` = 'IR8006'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006' 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` = 1855 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006' AND `Store` = 'BLG'

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` = 'IR8006'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

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

SELECT `ID` FROM `parts` WHERE `RefNumber` = 'IR8006VALEO' 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` = 145383 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006VALEO' AND `Store` = 'BLG'

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` = 'IR8006VALEO'

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

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

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006' AND `Store` = 'BLG'

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` = 'IR8006'

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

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IR8006R' AND `Store` = 'BLG'

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` = 'BGN'
             LIMIT 1

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

set names utf8

SELECT
                            `PriceListID`,
                            `PriceVisible`,
                            /*`PriceCorrection`,*/
                            `OEMSearch`,
                            `WithoutQty`
                        FROM
                            `users`
                        WHERE
                            `ID` = 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 'ia23%'
                    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 'ia23%'
                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` = 'IA230' 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` = 100096 AND
                    `users`.`ID` = 1030
                LIMIT 3
            ) AS `Result`;

SELECT `Quantity` FROM `availabilities` WHERE `RefNumber` = 'IA230' AND `Store` = 'BLG'

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` = 'IA230'

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

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` = 'BGN'
             LIMIT 1

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