troubleshooting Question

SQL Question for Inner join

Avatar of slightlyoff
slightlyoff asked on
Microsoft SQL ServerSQL
5 Comments3 Solutions83 ViewsLast Modified:
Select * from OrderDetails inner join Products on Products.ProductID = OrderDetails.ProductID inner join Discounts on OrderDetails.DiscountID = Discounts.DiscountID where OrderID = 213

I'm trying to pull all the OrderDetails records where OrderID = 213.
Some OrderDetails records have Discounts (and a Discount ID)
If no discount has been applied to the OrderDetails, the value for DiscountID is Null.

I need to pull OrderDetails for ALL records for OrderID 213 - even those with a NULL value for DiscountID.

I would appreciate any help sorting out this query.  right now it's returning 1 record, it should return 6.

Thanks for your help!!!

Steve
SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros