Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Join Between 2 Fields when Fields in One Table have Multiple Values

$
0
0

I have 2 Tables, which are joined by the customerID field. One table is an existing table where there will only be a single customer id in each row. The other comes from an import file (tblImportCustomer) where the customer id field may contain multiple values in the same row. Below is an example of the 2 tables.

tblCustomer	tblImportCustomer
CustomerID	CustomerID
1		1,5
2		2
3		3,7
4
5
6
7

With the above, there would be matches for Customers 1,2,3,5,7 in "tblCustomer", so those 5 records would be returned. Is there a way to set a relationship like this? Any assistance would be appreciated.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>