MYSQL在另一个字段中设置值时隐藏字段数据
有这样一张桌子:MYSQL在另一个字段中设置值时隐藏字段数据,mysql,select,if-statement,where,data-representation,Mysql,Select,If Statement,Where,Data Representation,有这样一张桌子: art. type price a b 1 a c 2 是否可以通过选择将筛选内容显示为: art. type price a b a c 2 因此,如果类型为“b”,则不显示价格数据 select art, type, price from x where type="b" hide price 这种逻辑最适合应用程序的表示层,而不是数据库
art. type price
a b 1
a c 2
是否可以通过选择将筛选内容显示为:
art. type price
a b
a c 2
因此,如果类型为“b”,则不显示价格数据
select art, type, price from x
where type="b" hide price
这种逻辑最适合应用程序的表示层,而不是数据库层。但是,仍然可以使用MySQL的函数或其表达式,例如:
SELECT art, type, IF(type='b',NULL,price) price FROM x;
请在上查看。决定是否隐藏字段的条件是什么?