Задавайте вопросы, мы ответим
Вы не зашли.
Страниц: 1
Здравствуйте!
Помогите пожалуйста разобраться:
есть два запроса:
1.
(SELECT DISTINCT `product_name` , `products_per_row` , `category_browsepage` , `category_flypage` , `jos_vm_category`.`category_id` , `jos_vm_product`.`product_id` , `product_full_image` , `product_thumb_image` , `product_s_desc` , `product_parent_id` , `product_publish` , `product_in_stock` , `product_sku` , `product_url` , `product_weight` , `product_weight_uom` , `product_length` , `product_width` , `product_height` , `product_lwh_uom` , `product_in_stock` , `product_available_date` , `product_availability` , `jos_vm_product`.`mdate` , `jos_vm_product`.`cdate`
FROM (
`jos_vm_product` , `jos_vm_category` , `jos_vm_product_category_xref` , `jos_vm_shopper_group`
)
LEFT JOIN `jos_vm_product_price` ON `jos_vm_product`.`product_id` = `jos_vm_product_price`.`product_id`
LEFT JOIN `jos_vm_product_type_1` ON `jos_vm_product`.`product_id` = `jos_vm_product_type_1`.`product_id`
LEFT JOIN `jos_vm_product_product_type_xref` ON `jos_vm_product`.`product_id` = `jos_vm_product_product_type_xref`.`product_id`
LEFT JOIN `jos_vm_shopper_vendor_xref` ON ( `jos_vm_shopper_vendor_xref`.`user_id` =62
AND `jos_vm_shopper_vendor_xref`.`shopper_group_id` = `jos_vm_shopper_group`.`shopper_group_id` )
WHERE `jos_vm_product_category_xref`.`product_id` = `jos_vm_product`.`product_id`
AND `jos_vm_product_category_xref`.`category_id` = `jos_vm_category`.`category_id`
AND `jos_vm_product_product_type_xref`.`product_type_id` =1
AND (
`udalenie_volos` LIKE '%Темные волосы%'
)
AND (
`jos_vm_product`.`product_id` = `jos_vm_product_price`.`product_id`
OR `jos_vm_product_price`.`product_id` IS NULL
)
AND `product_parent_id` =0
LIMIT 0 , 20)
-------------------------------------------------------------------------
2.
(SELECT DISTINCT `product_name` , `products_per_row` , `category_browsepage` , `category_flypage` , `jos_vm_category`.`category_id` , `jos_vm_product`.`product_id` , `product_full_image` , `product_thumb_image` , `product_s_desc` , `product_parent_id` , `product_publish` , `product_in_stock` , `product_sku` , `product_url` , `product_weight` , `product_weight_uom` , `product_length` , `product_width` , `product_height` , `product_lwh_uom` , `product_in_stock` , `product_available_date` , `product_availability` , `jos_vm_product`.`mdate` , `jos_vm_product`.`cdate`
FROM (
`jos_vm_product` , `jos_vm_category` , `jos_vm_product_category_xref` , `jos_vm_shopper_group`
)
LEFT JOIN `jos_vm_product_price` ON `jos_vm_product`.`product_id` = `jos_vm_product_price`.`product_id`
LEFT JOIN `jos_vm_product_type_2` ON `jos_vm_product`.`product_id` = `jos_vm_product_type_2`.`product_id`
LEFT JOIN `jos_vm_product_product_type_xref` ON `jos_vm_product`.`product_id` = `jos_vm_product_product_type_xref`.`product_id`
LEFT JOIN `jos_vm_shopper_vendor_xref` ON ( `jos_vm_shopper_vendor_xref`.`user_id` =62
AND `jos_vm_shopper_vendor_xref`.`shopper_group_id` = `jos_vm_shopper_group`.`shopper_group_id` )
WHERE `jos_vm_product_category_xref`.`product_id` = `jos_vm_product`.`product_id`
AND `jos_vm_product_category_xref`.`category_id` = `jos_vm_category`.`category_id`
AND `jos_vm_product_product_type_xref`.`product_type_id` =2
AND (
(`aktivnii_element` LIKE '%%')AND(`dlina_volni` LIKE '%%')AND(`method` LIKE '%%')AND(`Rashodnie_materiali` LIKE '%%')AND(`razmer_pyatna` LIKE '%%')AND(`resurs_lampi` LIKE '%%')
)
AND (
`jos_vm_product`.`product_id` = `jos_vm_product_price`.`product_id`
OR `jos_vm_product_price`.`product_id` IS NULL
)
AND `product_parent_id` =0
LIMIT 0 , 20)
----------------------------------------------------------
Пробовал объединять через UNION, получается что выводит все поля из запроса 1 и все поля из запроса 2
Может есть какой то способ показать только пересекающиеся поля
Подскажите что-нибудь... Буду рад любой помощи ).
Отредактированно ivankomolin (14.10.2009 08:57:55)
Неактивен
Неактивен
Страниц: 1