Skip to content
Advertisement

SELECT from Multiple IF conditions in Where Clause

I have a following query

In the above query I need to add IF condition that IF a.Type is Accessories then I need certain a.Brands to select from and if a.Type is Clothing then I need to select from certain a.Brands

Advertisement

Answer

Use a CASE expression, but you should also write a proper join with an ON clause for the 2 tables:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement