Skip to content
Advertisement

SQL query for Join statement

I have 3 tables products, pricingGroup and productPricing. I want to show all products even it has no service pricing and set its status/IsActive to false.

What query I have now

What I want to Get

Products Table


ProductPricing Table


PricingGroup Table


Advertisement

Answer

  • You are missing last join clause pricing.PricingGroup = prgrp.PricingGroupId.
  • You don’t need OR products.productId IS NULL because that is primary key of Products table and will not be null.
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement