0
我正在寫一個選擇查詢,在哪裏條件我想檢查一個字段值,如果它爲空,那麼只有我會其他字段值。請注意,select用於遊標。選擇查詢不給予想要的結果
原始查詢:
SELECT ni.node_installation_id,ni.customer_node_id,ni.customer_id,c.brand_name_1,substr(nitr.name,1,instr(nitr.name, ' ')-1) as node_inst_type
from node_installation ni , customer c , node_inst_type_release nitr
where ni.customer_id = c.customer_id
and ni.node_inst_type_release_id = nitr.node_inst_type_release_id
**and trunc(sysdate) - trunc(ni.arne_timestamp) >= 60**
and ni.no_of_collection_node_missed >= 4
and c.customer_id =90;
參考在大膽的聲明,如果ni.arne_timestamp爲空,結果也爲空。在這種情況下,我想檢查其他條件,如ni.arne_flag ='我',並採取選擇查詢這些行。希望這一次我很清楚。
您在使用此產品cartisian from子句中使用左聯接,而不是 –
滾裝原因是因爲你正在編寫古老的SQL。如果你使用ANSI92(1992!)語法,你可能會發現這個問題會神祕地消失,或者說明白。 – podiluska