我有这些我想做的多个选择语句
CREATE VIEW dbo.vw_customers_addresses_services_servicetanks
这是我的选择声明:
SELECT * FROM Customers
WHERE EXISTS
(SELECT * FROM Addresses
WHERE Addresses.OwnerId = Customers.Id
AND Addresses.OwnerId = 97587
AND Addresses.TenantId = 1013);
(SELECT * FROM Addresses
WHERE Addresses.OwnerId = 97587
AND Addresses.TenantId = 1013
AND Addresses.Type = 'Delivery');
SELECT * FROM dbo.Services
WHERE EXISTS
(SELECT * FROM Addresses
WHERE Addresses.Id = Services.AddressId
AND Addresses.OwnerId = 97587
AND Addresses.TenantId = 1013);
(SELECT ServiceTanks.*
FROM ServiceTanks, Addresses, Services
WHERE Services.Id = ServiceTanks.ServiceId
AND Addresses.Id = Services.AddressId
AND Addresses.OwnerId = 97587
AND Addresses.Tenantid = 1013)
它现在作为一个多选语句工作。但是,我的目标是通过 SQL 视图修改数据,在其中我可以使用 SSMS 和 EDIT TOP X ROWS 的魔力从第三个选择语句对 AddressID RESULT 进行快速更新。
当我将 CREATE VIEW 放在第一个 select 语句上方时,它会给出一个红色的大波浪线,上面写着“语法错误:'CREATE VIEW' 必须是批处理中的唯一语句。”
我是在做梦还是可以像我描述的那样做到这一点?