The title says most of what I wish to do. I have two tables "orders" and "Customers". the orders table contains the customerID of every customer who has placed an order and the customers table contains every customerID. I need to select and display the customers who have not placed an order. I know
I need to display the rows where the customerID from the customers table does not match the customerID from orders table.
I am not sure how to do this however and have not come across a solution that I can understand so any help would be much appreciated. This is what I have tried doing.
private void btnQ9_Click(object sender, RoutedEventArgs e)
{
DataClasses1DataContext dc = new DataClasses1DataContext();
var query = from c in dc.Customers
join o in dc.Orders on c.CustomerID equals o.CustomerID
group o by new { o.CustomerID, c.CompanyName } into grp
where(grp.Key.CustomerID.Count() ==0)
select new
{
CompanyName = grp.Key.CompanyName,
Order = grp.Key.CustomerID.Count()
};
DataQ9.ItemsSource = query.ToList();
}