Перчатки
SELECT SQL_CALC_FOUND_ROWS a.`Message_ID`, a.`User_ID`, a.`IP`, a.`UserAgent`, a.`LastUser_ID`, a.`LastIP`, a.`LastUserAgent`, a.`Priority`, a.`Parent_Message_ID`, sub.`Subdivision_ID`, CONCAT( '', sub.`Hidden_URL`), cc.`Sub_Class_ID`, cc.`EnglishName`, a.`Checked`, a.`Created`, a.`Keyword`, a.`LastUpdated` + 0 AS LastUpdated, a.Name, a.Manuf, a.ItemID, a.Description, a.Details, a.Price, tbl954.ShopCurrency_Name AS tbl954name, tbl954.ShopCurrency_ID AS tbl954id, tbl954.`Value` AS tbl954value , a.PriceMinimum, tbl962.ShopCurrency_Name AS tbl962name, tbl962.ShopCurrency_ID AS tbl962id, tbl962.`Value` AS tbl962value , a.Image, tbl958.ShopUnits_Name AS tbl958name, tbl958.ShopUnits_ID AS tbl958id, tbl958.`Value` AS tbl958value , a.StockUnits, a.ImportSourceID, a.TopSellingMultiplier, a.TopSellingAddition, a.VAT, a.Seasone, a.Sex, a.DefenceType, a.Size, a.ProductType, a.CapType, a.Weather, a.SnowboardSize, a.VeloSize, a.Vendor, a.id1C, a.Info, a.ShippingPayment, a.Color, a.discount, a.discountName, IFNULL(a.Price, parent.Price) as Netshop_Price_Column,
IFNULL(a.Currency, parent.Currency) as Netshop_Currency_Column,
IF(a.discount, a.Price - (a.discount * a.Price)/100, a.Price) as DiscountPrice
FROM (`Message57` AS a )
LEFT JOIN `Subdivision` AS sub ON sub.`Subdivision_ID` = a.`Subdivision_ID`
LEFT JOIN `Sub_Class` AS cc ON cc.`Sub_Class_ID` = a.`Sub_Class_ID` LEFT JOIN `Classificator_ShopCurrency` AS tbl954 ON a.`Currency` = tbl954.ShopCurrency_ID LEFT JOIN `Classificator_ShopCurrency` AS tbl962 ON a.`CurrencyMinimum` = tbl962.ShopCurrency_ID LEFT JOIN `Classificator_ShopUnits` AS tbl958 ON a.`Units` = tbl958.ShopUnits_ID LEFT JOIN Message57 as parent ON (a.Parent_Message_ID != 0 AND a.Parent_Message_ID=parent.Message_ID)
WHERE 1 AND a.`Parent_Message_ID` = '0' AND sub.`Catalogue_ID` = '1' AND a.`Subdivision_ID` = '163' AND a.`Sub_Class_ID` = '207' AND a.`Checked` = 1 ORDER BY DiscountPrice ASC LIMIT 0,15