Distinct Examples from one Table SQL Server

by Missy   Last Updated January 13, 2018 19:06 PM

I have a item file with one item per record and a detail file with many customers with many descriptions. Each customer can have many items. Each item can have many customers.

      File 1
             Item ID

      File 2
            Item ID 
            Customer Number   

I am trying to get a list of item IDs with only one customer number showing an example of one customer who has each item.

   Select * from file1 left join         
      (select distinct itemid, customernumber from File2) B 
    ON A.itemid = b.itemid

Gives me too many results. Any advice or suggestions would be greatly appreciated.

Tags : sql-server

Related Questions

creating index on big table(s)

Updated September 03, 2018 18:06 PM

Linked Server Error on SQL Agent Job

Updated March 16, 2016 08:02 AM