2017-01-11 20 views
0

這是我的SQL查詢操作數應包含1列(S)我得到這個錯誤,而在執行刪除查詢

delete FROM 
SubMaster_test1 
where SubMasterId in (select * 
from SubMaster_test1 where AgentId 
not in (select distinct 
introducer from SubMaster_test1 
where introducer is not null)) 

我得到以下錯誤

[錯誤] 1241 - 的操作對象包含1列(S)

+0

[的MySQL可能的複製 - 操作數應包含1列(S)](http://stackoverflow.com/questions/14046838/mysql-operand-should-contain-1-columns) –

回答

0

你應該只賴特的 「ID」, 「*」

delete FROM 
    SubMaster_test1 
    where SubMasterId in (select SubMasterId 
    from SubMaster_test1 where AgentId 
    not in (select distinct 
    introducer from SubMaster_test1 
    where introducer is not null)) 
+0

[錯誤] 1093 - 您不能指定目標表 'SubMaster_test1' 的更新在FROM子句...得到這個錯誤 –

+0

我知道it.make臨時表只有一列與id並插入此SubMasterId到它然後使用此表來刪除數據 –

+0

插入到溫度選擇SubMasterId 從SubMaster_test1其中AgentId 不在(選擇SubMaster_test1 不同 介紹人那裏介紹人不是null) –

相關問題