1. 程式人生 > >mysql 子查詢優化

mysql 子查詢優化

一般寫子查詢的時候:SELECT max(`Posted-date`) as `Postedday` FROM `transaction`where `unique_key` in ("SELECT `unique_key` from `transaction` where `seller`="."'$count_seller'");執行的時候會很慢;

優化:SELECT max(`Posted-date`) as `Postedday` FROM `transaction`where `unique_key` in(SELECT `unique_key` from ("SELECT `unique_key` from `transaction` where `seller`="."'$count_seller'") as tbt));

                   
                  
                   "