Hello,
I have a SQL Server 2008 database with 2 tables. These tables are Address and Store. These tables are defined as
Address
--------
ID (int)
Line1 (nvarchar(255))
PostalCode (nvarchar(5))
City (nvarchar(255))
State (nvarchar(255))
Store
-----
ID (int)
LocationID (int)
Name
I am trying to find a list of stores that are located at the same address by Line1 and PostalCode. I need to ignore the ID because of duplicate records. I do not care about stores that are the only store at their location. Rather, I only want a list of stores that share a location. Unfortunately, I'm not sure how to do this.
How do I write a query that will only return records that are group to address at the same Line1 and PostalCode?
Thank you!