Invalid query: select
CatItems2.*,
CatItems.LocalityName,
CatItems.Name,
CatItems.Logo,
GoldItems.ItemID, if(GoldItems.__id > 0, 1, 0) as GoldTariff,
CatItems.dir,
yc1.name as Category1,
yc2.name as Category2,
yc3.name as Category3,
yc4.name as Category4,
CatItems.allowRating,
CatItems.AdministrativeAreaName,
CatItems.Phones,
CatItems.Address,
CatItems.Shirota,
CatItems.Dolgota,
CatItems.RatingCount,
CatItems.RatingAverage,
CatItems.RatingSummPositive
from (
select
CatItems.__id,
GoldItems.ItemID, if(GoldItems.__id > 0, 1, 0) as GoldTariff,
if(CatItems.SilverTariffEnd > NOW(), CatItems.SilverTariffEnd, 0) as SilverEndDateTime,
if(CatItems.VIPInfoTariffEnd > NOW(),'1',0) as VIPInfoTariffEnd
from
CatItems
left join YandexCategories yc1 on yc1.__id = CatItems.Category1ID
left join YandexCategories yc2 on yc2.__id = CatItems.Category2ID
left join YandexCategories yc3 on yc3.__id = CatItems.Category3ID
left join YandexCategories yc4 on yc4.__id = CatItems.Category4ID
left join CatParameter2Items on CatParameter2Items.CatItemID = CatItems.__id
left join GoldItems on GoldItems.ItemID = CatItems.__id
and GoldItems.Year='2024'
and GoldItems.Month='7'
where
CatItems.Active='1' AND ( CatItems.Country='Россия' ) AND ( yc1.name='СПА-салон' OR yc2.name='СПА-салон' OR yc3.name='СПА-салон' OR yc4.name='СПА-салон' )
group by CatItems.__id
order by
GoldTariff desc, SilverEndDateTime desc, CatItems.CustomOrder, CatItems.RatingSummPositive desc, CatItems.RatingAverage desc, CatItems.RatingCount desc, CatItems.__id asc
limit
500, 50
) CatItems2
left join CatItems on CatItems.__id=CatItems2.__id
left join YandexCategories yc1 on yc1.__id = CatItems.Category1ID
left join YandexCategories yc2 on yc2.__id = CatItems.Category2ID
left join YandexCategories yc3 on yc3.__id = CatItems.Category3ID
left join YandexCategories yc4 on yc4.__id = CatItems.Category4ID
left join CatParameter2Items on CatParameter2Items.CatItemID = CatItems.__id
left join GoldItems on GoldItems.ItemID = CatItems.__id
and GoldItems.Year='2024'
and GoldItems.Month='7'
group by CatItems.__id
order by
GoldTariff desc, SilverEndDateTime desc, CatItems.CustomOrder, CatItems.RatingSummPositive desc, CatItems.RatingAverage desc, CatItems.RatingCount desc, CatItems.__id asc
Error writing file '/tmp/MYfd=517' (OS errno 28 - No space left on device)