select T_SM_Seat.SeatID,SeatNO,
(case when EnterOutState is null then 3 else EnterOutState end) SeatState 
from T_SM_Seat left OUTER join T_SM_EnterOutLog on 
(
  T_SM_Seat.SeatNo = T_SM_EnterOutLog.SeatID and  T_SM_EnterOutLog.EnterOutState <>3 and 
  T_SM_EnterOutLog.EnterOutType = 1   
) where  T_SM_Seat.ReadingRoomID = 7这样一个sql语句,不加where条件总共就497条数据,瞬间查出。条件的值为6的时候,也是瞬间查出。就是当where条件值为7的时候查询需要1秒。不知道有没有高手遇到过同样的问题!