Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EmailAddress EntityId
- 12_abc@abc.com::::13_pqr@pqr.com 101
- 12_koi@koi.com::::13_poi@poi.com 102
- EmailAddress EmailTypeId EntityId
- abc@abc.com 12 101
- pqr@pqr.com 13 101
- koi@koi.com 12 102
- poi@poi.com 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
Advertisement