Select
*
from [myTable]
WHERE [myTable].ID IN
(
Select
Min([myTable].ID),
[myTable].Username
FROM [myTable]
group by [myTable].Username);
刪除重複的記錄給我的錯誤:我不知道它爲什麼給這個錯誤。在主鍵
You have written a subquery that can return more than one field without using EXISTS reserved word in the main query's FROM clause. Revise the Select statement of the subquery to request only one field
我用戶名重複的記錄,所以我想用的ID號MIN作爲第一個記錄用戶名是爲了消除他們正確。有人可以幫助或告訴我在哪裏看?
+------+-------+-------+---------+--------------+
| Data | id | Fname | Lname | Status |
+------+-------+-------+---------+--------------+
| 1 | 12345 | Kunal | Kumar | completed |
| 2 | 12345 | Kunal | Kumar | Not Started |
| 3 | 12346 | Rahul | Malviya | Completed |
| 4 | 12346 | Rahul | Malviya | Not Started |
+------+-------+-------+---------+--------------+
向我們展示db模式,樣本數據,當前和預期輸出。 \t請閱讀[**如何提問**](http://stackoverflow.com/help/how-to-ask) \t \t這裏是一個偉大的地方[** START **] (http://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-public-forum/)來了解如何提高您的問題質量並獲得更好的答案。 \t [**如何創建一個最小,完整和可驗證的示例**](http://stackoverflow.com/help/mcve) –
仍然需要預期的輸出 –
謝謝,它的工作。我猜在內部查詢我們不應該使用用戶名列,刪除後,查詢工作正常。謝謝胡安 –