1
選擇我目前使用的是選擇中的選擇,以檢查是否在表中存在的數據:內選擇慢
select
a.id,
a.desc,
a.serial,
a.partno,
a.maintact,
a.lcnalc,
a.datedue,
a.intrem,
a.lifetype,
(select b.id from assets b where
(b.maintact = a.maintact) and
(b.aircraft_id = a.aircraft_id) and
(b.inittype = "STRT") and
(b.initlcnalc = a.lcnalc OR b.initlcnalc = "")) as parent
from assets a where aircraft_id = 6;
我想知道的是一種更有效的方式做到上面的查詢?
順便說一句,一旦添加了'(b.inittype =「STRT」)''常量條件,'LEFT JOIN'就會衰變成一個普通的'JOIN'。 – wildplasser
@wildplasser是的你是對的,我錯過了,thx – Stephan