Re: [MySQL] JOIN на одну таблицу 2 раза
От: naf_2000  
Дата: 31.07.09 07:20
Оценка: -1
select product_id, spec_value
from specs
where spec_id='A'
and not(product_id in
(select distinct product_id
 from specs
 where spec_id='B'))
или
select product_id, spec_value
from specs S
left join 
(select distinct product_id from specs where spec_id='B') S2 on (S.product_id=S2.product_id)
where S.spec_id='A'
and S2.product_id is null
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.