sqlhideconditional-statements

How to hide column based on condition


Im newbie in sql and i want to filter results of a select statement.I would like to hide the value of specific column in case of a specific value in another column(same row). For example i want the Products.product column to be hidden or empty in case that the value in the Products.active column is false : Thanks in advance

SELECT Products.product,Products.Active,
CASE Products.product
 WHEN  'false' THEN Products.Active = '' 
END          
FROM Products

Solution

  • SELECT Products.Active,
    CASE Products.Active
     WHEN  'false' THEN  '' 
     ELSE  Products.product
    END  AS 'HIDDEN COLUMN'
    FROM Products
    

    msdn