Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 739
alipkok Avatar asked Dec 11 '25 10:12

alipkok


1 Answers

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

msdn

like image 114
gh9 Avatar answered Dec 13 '25 10:12

gh9



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!