推 grence: ^似..看到這篇文才想到 05/22 17:04
※ 引述《grence (多想兩分鐘 = =")》之銘言:
: 1.把 fid串起來再比對,MySql有group_concat()
: 2.配合AP串 SQL做起來滿直覺的……
: pid in(select pid...where fid=1) and
: pid in(select pid...where fid=2) and ..
: 就是感覺會很慢XD
原來還有group_concat()這個用法啊..
不過如果條件是 1,3 ,而fid的集合是(1,2,3)的話....
還是要搭配到2的方法用FIND_IN_SET啊 XDD
後來用google查到比較接近的方法是
select Product_ID,feature from
Product_Feature PF,Features F where PF.fid in(1,2) and PF.fid = F.Fid
group by Product_id having count(*) = 2
標顏色的字由輸入端控制
要搭配資料時再去做outer join的動作
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.105.55.46