Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EmailAddress EntityId
- EmailAddress EmailTypeId EntityId
- [email protected] 12 101
- [email protected] 13 101
- [email protected] 12 102
- [email protected] 13 102
- DECLARE @MyTableVariable TABLE
- (
- EmailAddress nvarchar(250),
- EntityIDE int
- );
- INSERT @MyTableVariable(
- EmailAddress,
- EntityIDE
- )
- SELECT concat([EmailTypeID], '_____', [EmailAddress]))), [EntityID]
- FROM [dbo].[Email_Addresses] where [EntityID] in
- (select [EntityID] from [Entities] where [SourcePrimaryKey] in
- (select [MerchantOwnerID] from [dbo].[Merchant_Owners] where [MerchantID] = 1 ) and
- [EntityTypeID] = (select [EntityTypeID] from [Entity_Types] where [EntityType] = 'MerchantOwner'))
- select * from @MyTableVariable
- (select [EntityID] from [Entities] where [SourcePrimaryKey] in
- (select [MerchantOwnerID] from [dbo].[Merchant_Owners] where [MerchantID] = 1 ) and
- [EntityTypeID] = (select [EntityTypeID] from [Entity_Types] where [EntityType] = 'MerchantOwner'))
- EntityId
- 101
- 102
- 103
- 104
- ...
Advertisement
Add Comment
Please, Sign In to add comment