1
插入多行我使用SQL Server 2008和與其他線程的幫助下,我已經能夠寫:基於SELECT語句
insert into fml0grant (auto_key, roleid)
select fml0.auto_key, 20
from fml0
left join fml0grant on fml0.auto_key = fml0grant.auto_key
where fml0.dwgname <> ''
and fml0grant.roleid is null
但是我需要做的是插入多行每條記錄都在where子句中找到。所以當where子句得到一個結果,我需要插入:
- fml0.auto_key,20
- fml0.auto_key,508
- fml0.auto_key,10
有什麼辦法將所有三個插入組合成一個語句,就像在查詢中的第一個語句之後,WHERE子句中的NULL不再爲真。
這個問題不清楚,請看看[這裏](https://spaghettidba.com/2015/04/24/how-to-post-at-sql-question-on-a-公共論壇/)如何改善問題.. – TheGameiswar