How to select distinct items from table by a variable and then join another table in LINQ
I have a query where I need to select distinct order numbers from a table of orders. An order number can correspond to multiple entries in the table of orders but I only want distinct orders. I.E. I only want to grab one entry for a given order number. Then I want to join that with a customers table on o.CustomerKey equals c.CustomerKey. I have tried doing this in a couple different ways and haven’t found a fast and concise way of doing it. My thought is to select distinct orders by OrderNumber then join the Customers table where conditional criteria is met then select my data I need to return.