看板 Database 關於我們 聯絡資訊
請教一下 我有看到這個例子 (一) select * from table1 cross join table 2 where table1.id = table2.fd_id (二) select * from table1 join table2 on table1.id =table2.fd_id 這兩個結果是一樣的 但是(二)這個效能會比較好嗎?? cross join 不是只差在把where換成on這樣子而已呢?? 還麻煩前輩指教一下,謝謝了 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.120.19.22 ※ 文章網址: http://www.ptt.cc/bbs/Database/M.1403433479.A.090.html
scpisces:我認為是 06/22 22:19
scpisces:(一)假設table1、table2各10筆資料,使用cross join後 06/22 22:20
scpisces:會變100筆資料,再根據where條件撈出所要的資料 06/22 22:20
scpisces:(二)table1、table2有相同的資料才會出來 06/22 22:20
scpisces:所以效能上來說,是(二)比較好 06/22 22:21
scpisces:如有錯請糾正 06/22 22:21