50 lines
1.8 KiB
SQL
50 lines
1.8 KiB
SQL
select distinct(i_product_name)
|
|
from item i1
|
|
where i_manufact_id between 704 and 704+40
|
|
and (select count(*) as item_cnt
|
|
from item
|
|
where (i_manufact = i1.i_manufact and
|
|
((i_category = 'Women' and
|
|
(i_color = 'forest' or i_color = 'lime') and
|
|
(i_units = 'Pallet' or i_units = 'Pound') and
|
|
(i_size = 'economy' or i_size = 'small')
|
|
) or
|
|
(i_category = 'Women' and
|
|
(i_color = 'navy' or i_color = 'slate') and
|
|
(i_units = 'Gross' or i_units = 'Bunch') and
|
|
(i_size = 'extra large' or i_size = 'petite')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'powder' or i_color = 'sky') and
|
|
(i_units = 'Dozen' or i_units = 'Lb') and
|
|
(i_size = 'N/A' or i_size = 'large')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'maroon' or i_color = 'smoke') and
|
|
(i_units = 'Ounce' or i_units = 'Case') and
|
|
(i_size = 'economy' or i_size = 'small')
|
|
))) or
|
|
(i_manufact = i1.i_manufact and
|
|
((i_category = 'Women' and
|
|
(i_color = 'dark' or i_color = 'aquamarine') and
|
|
(i_units = 'Ton' or i_units = 'Tbl') and
|
|
(i_size = 'economy' or i_size = 'small')
|
|
) or
|
|
(i_category = 'Women' and
|
|
(i_color = 'frosted' or i_color = 'plum') and
|
|
(i_units = 'Dram' or i_units = 'Box') and
|
|
(i_size = 'extra large' or i_size = 'petite')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'papaya' or i_color = 'peach') and
|
|
(i_units = 'Bundle' or i_units = 'Carton') and
|
|
(i_size = 'N/A' or i_size = 'large')
|
|
) or
|
|
(i_category = 'Men' and
|
|
(i_color = 'firebrick' or i_color = 'sienna') and
|
|
(i_units = 'Cup' or i_units = 'Each') and
|
|
(i_size = 'economy' or i_size = 'small')
|
|
)))) > 0
|
|
order by i_product_name
|
|
limit 100;
|