在我之前的問題中,我問過將查詢的結果存儲在變量中......現在我意識到查詢可以返回多行。我可以將存儲過程查詢中的多行傳入另一個查詢嗎?
目前,我有這樣的:
SELECT @UserId = UserId FROM aspnet_Users WHERE UserName = @username
我想要做這樣的事情:
DELETE FROM some_table WHERE UserId IN (*the ID list*)
DELETE FROM some_table_2 WHERE UserId IN (*the ID list*)
我的第一反應就是用「GROUP_CONCAT」,但顯然這是一個MySQL特有的功能。有一些方法可以使等價的功能,但我想知道是否有更好的方式來構建查詢?
@OMG小馬:爲什麼要刪除'group-concat'標籤?這不重要,但重點是什麼? – DisgruntledGoat 2010-07-01 18:09:54