Disk full (/tmp/#sql-temptable-22c-5fb5e2-10660d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device"), query:SELECT DISTINCT
p_local.price price_local,
c.*,
(SELECT
`price`
FROM `catalog_price` cp
WHERE c.id=cp.`id_good` AND cp.`id_discount_group`=14 ) price_krs_retail,
if( (SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN(2,4,10,11,12,14,15,16,17,18) ) > 0 , 1, 0) total_availble,
(SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (4) ) av_retail_uss_shops,
(SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (14) ) av_krs_opt,
(SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (15) ) av_hbr_opt,
(SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (16) ) av_komar_opt,
(SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (17) ) av_vl_opt,
(SELECT SUM(cda.`avail`) FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (18) ) av_art_opt,
(SELECT
`price`
FROM `catalog_price` cp
WHERE c.id=cp.id_good AND cp.`id_discount_group`= 5) price_vl_retail,
(SELECT
`price`
FROM `catalog_price` cp
WHERE c.id=cp.id_good AND cp.`id_discount_group`=15 ) price_krs_opt,
(SELECT
`price`
FROM `catalog_price` cp
WHERE c.id=cp.id_good AND cp.`id_discount_group`=11 ) price_hbr_opt,
(SELECT
SUM(cda.`avail`) sum
FROM `catalog_avail` cda
WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (2,17) ) av_vl,
(SELECT
SUM(cda.`avail`) sum
FROM `catalog_avail` cda
WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (10,15) ) av_hbr,
(SELECT
SUM(cda.`avail`) sum
FROM `catalog_avail` cda
WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (11,14) ) av_krs,
(SELECT
SUM(cda.`avail`) sum
FROM `catalog_avail` cda
WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN (12,18) ) av_art,
(SELECT
SUM(cda.`avail`) sum
FROM `catalog_avail` cda
WHERE cda.`id_good`=c.`id` AND cda.`id_shop` IN ( SELECT `id` FROM `catalog_shops` WHERE `depot_id`=5 AND `is_retail`=1 ) ) av_uss,
(SELECT COUNT(*) FROM `billing_basket` WHERE `status`='get' AND `price_id`=c.`id` AND `depot_id`=5 AND `user`='f2dce04a438394c5d47faa6cec5cdc7d' AND `user`!='' ) inbasketuss,
(SELECT COUNT(*) FROM `billing_basket` WHERE `status`='get' AND `price_id`=c.`id` AND `depot_id`=1 AND `user`='f2dce04a438394c5d47faa6cec5cdc7d' AND `user`!='' ) inbasketvl,
(SELECT COUNT(*) FROM `billing_basket` WHERE `status`='get' AND `price_id`=c.`id` AND `depot_id`=3 AND `user`='f2dce04a438394c5d47faa6cec5cdc7d' AND `user`!='' ) inbaskethbr,
(SELECT COUNT(*) FROM `billing_basket` WHERE `status`='get' AND `price_id`=c.`id` AND `depot_id`=4 AND `user`='f2dce04a438394c5d47faa6cec5cdc7d' AND `user`!='' ) inbasketkrs,
(SELECT COUNT(*) FROM `billing_basket` WHERE `status`='get' AND `price_id`=c.`id` AND `depot_id`=6 AND `user`='f2dce04a438394c5d47faa6cec5cdc7d' AND `user`!='' ) inbasketart,
p_vl.price price_vl,
IF( c.markingsearch = '312503221' , 1, 0 ) is_m_equality,
p_krs.price price_krs,
IF(
(
(
c.markingsearch LIKE '312503221'
OR c.name='312503221'
OR (SELECT COUNT(*) FROM catalog_oem WHERE (oemsearch LIKE '312503221%' OR oem='312503221' ) AND `id_good`=c.`id` ) > 0
OR c.searchindex LIKE '%312503221%'
OR ( ( c.name LIKE '%312503221%') )
OR ( ( CONCAT_WS(' ', c.f_name, c.mark,c.model,c.chassis,c.engine,c.f_body) LIKE '%312503221%') )
OR ( ( replace(c.`searchindex`,' ','') LIKE '%312503221%') )
OR ( ( replace(c.`searchindex`,' ','') LIKE '%312503221%') )
)
),
1,0
) st,
IF(
(
(
c.markingsearch LIKE '312503221'
OR ( SELECT COUNT(*) FROM catalog_oem WHERE (oemsearch LIKE '312503221%' OR oem='312503221' ) AND `id_good`=c.`id` ) > 0
OR ( ( replace(c.searchindex,' ','') LIKE '%312503221%') )
)
),
1,0
) morf,
b.brand,
cg.name `group_name`,
(SELECT oem FROM catalog_oem WHERE (oemsearch LIKE '312503221%' OR oem='312503221' ) AND `id_good`=c.`id` LIMIT 1) oemtarget,
(SELECT GROUP_CONCAT(DISTINCT co.oem ORDER BY co.oem ASC SEPARATOR ', ') FROM catalog_oem co WHERE co.`id_good`=c.`id` ) oem
FROM `catalog` c
LEFT JOIN `brands` b ON c.brand_id=b.id
LEFT JOIN `catalog_groups` cg ON c.id_group=cg.id
LEFT JOIN `catalog_price` p_vl ON c.id=p_vl.id_good AND p_vl.`id_discount_group`= 5
LEFT JOIN `catalog_price` p_local ON c.id=p_local.id_good AND p_local.`id_discount_group`= 5
LEFT JOIN `catalog_price` p_krs ON c.id=p_krs.id_good AND p_krs.`id_discount_group`= 14
WHERE ( p_vl.price>0 OR p_krs.price>0 OR (SELECT COUNT(*) FROM `catalog_future` WHERE id1c = c.id_1c AND datein > NOW())>0) AND
( c.is_delete=0 AND
(c.hideavailble=0 OR (c.hideavailble =1
AND (SELECT SUM(cda.avail) sum FROM `catalog_avail` cda WHERE cda.`id_good`=c.`id`)>0 ) ))
AND (
c.markingsearch LIKE '312503221%'
OR c.name = '312503221'
OR c.id IN ( SELECT id_good FROM catalog_oem WHERE oemsearch LIKE '312503221%' OR oem='312503221')
OR ( ( c.name LIKE '%312503221%') )
OR
( ( CONCAT_WS(' ', c.f_name, c.mark,c.model,c.chassis,c.engine,c.f_body) LIKE '%312503221%') )
)
AND (
(SELECT
COUNT(*) cnt
FROM `catalog_avail` cda
WHERE
cda.`date_in` !=''
AND cda.`date_in` IS NOT NULL
AND cda.`id_good`=c.`id`
AND cda.`id_shop` IN (SELECT `id` FROM `catalog_shops` WHERE 1=1 AND `is_opt`=1 )
)>0
OR (p_vl.`price`>0 OR p_krs.`price`>0 OR (SELECT COUNT(*) FROM `catalog_future` WHERE id1c = c.id_1c AND datein > NOW())>0 ) )
ORDER BY is_m_equality DESC,morf DESC,st DESC,av_vl DESC ,c.id LIMIT 0,20
Результаты поиска по запросу (312503221) / Autodepo.ru