我不確定如何命名標題,所以提前抱歉。如何在SQL SELECT查詢中替換返回的列值?
不管怎麼說,我有以下SQL SELECT查詢(Oracle)的搜索請求的特定狀態:
SELECT ib.incident_id,
ib.incident_status_id
FROM cs_incidents_all_b ib, cs_incidents_all_tl it
WHERE ib.incident_id = it.incident_id
AND ib.incident_status_id IN (
SELECT st.incident_status_id
FROM cs_incident_statuses_tl st
WHERE st.NAME IN
('Accept Order',
'Order Accepted',
'Address Retrieved',
'Analyze',
'Entered',
'Information Retrieved',
'Retrieve Address',
'Retrieve Information',
'Returned'));
目前,運行此查詢時,我得到了最後一欄下面的輸出(incident_status_id):103
這個數字是在cs_incident_statuses_tl表中的關鍵字,並在該表中,有一列namned 名,有一個明確的文本字符串,在這種情況下,「安alyze」。
如何修改上面的SELECT查詢,以便它在運行時返回不顯示103而是分析?我嘗試過使用各種JOIN,但我還沒有找到一種好的方法來提供明文描述。
任何幫助非常感謝,提前致謝!對不起,如果問題的愚蠢,SQL遠沒有我的特長。 :)
似乎完全正常工作,非常感謝! – BeeDog