我想在我的表tblSubscriptions中插入数据,我只想使用一个insert语句.我将为User Table中的每个userId插入数据.以下SQL不起作用.
Insert tblSubscriptions (UserID, ProductID, isACtive, SubscriptionDays, Price, MonthlyPrice, ProductType, CurrencyID) Values ((Select userID From tblUser where SubscriptionType in(1, 0, null)), 7, 1, 0, 0, 0, 30, 1)
如何使用一个插入语句,即没有游标.
INSERT INTO tblSubscriptions (UserID, ProductID, IsActive, SubscriptionDays, Price, MonthlyPrice, ProductType, CurrencyID) SELECT UserID, 7, 1, 0, 0, 0, 30, 1 FROM tblUser WHERE ISNULL(SubscriptionType, 0) IN (1, 0)