0
我試圖將某些表遷移到現有的表中,我只需要執行更新,其中DET_ATTACHMENT_ID
等於DET_ATTACHMENT.ID
,這裏是我迄今爲止的查詢。更新來自oracle中的連接表的行
UPDATE DET_ATTACHMENT
SET attachment_type = 'LAB', -- being added by the query, to replace the table difference
payer_criteria_id = (
SELECT PAYER_CRITERIA_ID
FROM DET_LAB_ATTACHMENT
WHERE DET_LAB_ATTACHMENT.DET_ATTACHMENT_ID = DET_ATTACHMENT.ID)
WHERE exists(
SELECT DET_ATTACHMENT_ID
FROM DET_ATTACHMENT
JOIN DET_LAB_ATTACHMENT ON (ID = DET_ATTACHMENT_ID)
WHERE DET_ATTACHMENT_ID = DET_ATTACHMENT.ID
與現有查詢的問題是,它的設置每行,從而具有「LAB」的attachment_type
和歸零了payer_criteria_id
它不匹配。我究竟做錯了什麼?
你缺少attachment_type =在哪裏「LAB」條件存在條款 – radar 2014-10-06 19:56:45
@Rajesh不存在,直到此更新 – xenoterracide 2014-10-06 19:59:14
@xenoterracide,你可以這樣在where子句中存在選擇DET_ATTACHMENT_ID FROM DET_ATTACHMENT JOIN DET_LAB_ATTACHMENT ON DET_ATTACHMENT_ID = DET_ATTACHMENT.ID – radar 2014-10-06 20:03:09