我有 2 个表 EnquiryMaster 和 Requirement。我想从表 EnquiryMaster 中删除重复的 Company,其 enqiryid 在 Requirement 表中不存在
CREATE TABLE [dbo].[EnquiryMaster](
[EnquiryId] [int] IDENTITY(1,1) NOT NULL,
[orgid] [int] NULL,
[uid] [int] NULL,
[Company] [varchar](160) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[HeadOfficeAddress] [varchar](460) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_EnquiryMaster] PRIMARY KEY CLUSTERED
(
[EnquiryId] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Requirement](
[RequirementID] [int] IDENTITY(1,1) NOT NULL,
[uid] [int] NULL,
[orgid] [int] NULL,
[EnquiryID] [int] NULL,
[Company] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Requirement] PRIMARY KEY CLUSTERED
(
[RequirementID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]