create TABLE ta (
id smallint(5) unsigned NOT NULL default'0'
)
insert INTO`ta` VALUES("1"),("2"),("3"),("4")
select BIT_OR(id) from ta;
select BIT_AND(id) from ta;
alter table ta add column cust_type varchar(100);
update ta set cust_type='2' where id>3;
update ta set cust_type='1' where cust_type is null;
select cust_type,BIT_OR(id) from ta group by cust_type
select cust_type,BIT_and(id) from ta group by cust_type
mysql 之bit_or , bit_and 做统计
最新推荐文章于 2024-06-16 21:46:59 发布