Re: [MySQL] 同Table中的交集運算

看板Database (資料庫)作者 (夏天到了,冷不起來了說)時間16年前 (2009/05/22 15:28), 編輯推噓2(200)
留言2則, 1人參與, 最新討論串3/3 (看更多)
※ 引述《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

05/22 16:58, , 1F
嗯..本版有類例解法 #188hs7Qq
05/22 16:58, 1F

05/22 17:04, , 2F
^似..看到這篇文才想到
05/22 17:04, 2F
文章代碼(AID): #1A5bGSTN (Database)
討論串 (同標題文章)
文章代碼(AID): #1A5bGSTN (Database)