I have 2 tables, 1st table has domains and ID for the domain, 2nd table has customer info corresponding to that ID.
Using the domain name, I need to get the customer info for that domain, this can only be done by first getting the ID and using that ID to get the customer info.
I am able to successfully get the customer info from domain name, but the problem is, my final result must have the customer info and the domain name associated with it (2nd table has no domain name).
How I get the Customer Info:
SELECT ContactName, EmailAddress
FROM [Database].[dbo].[Customers]
WHERE CustomerID IN (
SELECT CustomerID
FROM [Database].[dbo].[Domains]
WHERE DomainName IN (*list of domains*)
)
So the final result must have a table with columns like this
ContactName | EmailAddress | DomainName
How would I go about this?