| 導購 | 订阅 | 在线投稿
分享
 
 
 

oracle中用not in性能不好,但我不知下面的語句該如何優化,還望高手指點

來源:互聯網  2004-12-01 13:50:56  評論

select a.id as id,b.username as username,c.username as payto,a.amount as amount,a.trade_time as trade_time,d.explanation as explanation from trade_line a,user_info b,user_info c,trade_type d where a.id not in (select id from trade_line where rownum<={(curpage-1)*pagesize)} and trade_type like 『{tradetype}』 and (user_id='{loginBean.getUserId()}' or payto_id='{loginBean.getUserId()}') and to_char(trade_time,'YYYYMMDD') between '{begindate}' and '{enddate}') and rownum<={pagesize} and a.trade_type like '{tradetype}' and (a.user_id='{loginBean.getUserId()}' or a.payto_id='{loginBean.getUserId()}') and to_char(a.trade_time,'YYYYMMDD') between '{begindate}' and '{enddate}' and a.user_id=b.user_id and a.payto_id=c.user_id and a.trade_type=d.trade_type order by a.id;

其中大括號內的是變量

select a.id as id,b.username as username,c.username as payto,a.amount as amount,a.trade_time as trade_time,d.explanation as explanation from trade_line a,user_info b,user_info c,trade_type d where a.id not in (select id from trade_line where rownum<={(curpage-1)*pagesize)} and trade_type like 『{tradetype}』 and (user_id='{loginBean.getUserId()}' or payto_id='{loginBean.getUserId()}') and to_char(trade_time,'YYYYMMDD') between '{begindate}' and '{enddate}') and rownum<={pagesize} and a.trade_type like '{tradetype}' and (a.user_id='{loginBean.getUserId()}' or a.payto_id='{loginBean.getUserId()}') and to_char(a.trade_time,'YYYYMMDD') between '{begindate}' and '{enddate}' and a.user_id=b.user_id and a.payto_id=c.user_id and a.trade_type=d.trade_type order by a.id; 其中大括號內的是變量
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
王朝網路微信公眾號
微信掃碼關註本站公眾號 wangchaonetcn
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有