2013-08-02 127 views
-6
EmployeeID Name EmployeeType 
---------- ---- ------------ 
123456  ramesh Employee_full 
3456   ramesh Contractor 
234557  ramu Employee_full 
2354   ramu Temp_emp 
345678  rammy Employee_full 
4568   rammy Contractor 

上面是查詢的輸出,我想這個輸出被送入作爲一個子查詢,以便得到下面的輸出考慮下面的輸出,我希望輸出如下

EmployeeID Name EmployeeType 
---------- ---- ------------ 
123456  ramesh Employee_full 
3456   ramesh Contractor 
345678  rammy Employee_full 
4568   rammy Contractor 

我需要刪除名爲ramu的員工的記錄。誰可以幫我這個事?

+4

不......您的嘗試在哪裏? – Trent

+2

如果你只需要過濾'ramu',使用'WHERE Name <>'ramu''。否則,我們需要更多的信息。 – zimdanen

+0

等等,所以你知道*子查詢*但不是基本的'WHERE'子句? –

回答

4

當你沒有說任何條件,那麼這將是容易做起來像

 SELECT * FROM your_table where Name <> 'ramu' 
  • 或者我猜你想排除Name其中employeetypeTemp_emp

然後使用這個

 SELECT * FROM table1 where Name not in 
    (select Name from table1 where EmployeeType = 'Temp_emp') 

DEMO HERE