1. 程式人生 > >一次sql優化的記錄

一次sql優化的記錄

select a.band,a.name from radio as a where exists ( select radio.id from radio,(select radio_nj.radio_id as radio_id from user,radio_nj where user.role != 5 and user.id = radio_nj.user_id) as b where radio.id = b.radio_id )



select a.band,a.name from radio as a where a.id in (select radio_nj.radio_id from user,radio_nj where user.role != 5 and user.id = radio_nj.user_id);



同樣的效果,前面那條只需要0.5秒 後面那條半天沒有沒出來