SQL Inner Join Question
Posted on 2012-03-27
I have an SQL Statement that joins Table A - "Products" with Table B - "Brands" based on a BrandID.
Brand information isn't required. so in many cases, there is no BrandID in the Products Table. The value for BrandID in the Products Table is 0 when no Brand is assigned.
For those products that do have a BrandID, I need to grab the related BrandName . For those that don't have a BrandID, I still need them included in the results.
My statment looks like this:
"Select products.id, products.desc, products.details, brands.BrandName, products.IDBrand from products inner join Brands on brands.BrandID = products.BrandID"
I'm hoping to return all the products in the database, but this will only return those that can be joined with the Brand table. I'm not sure how to work around this.
Thanks for your help!!!