怎么根据统计出来的次数来改变标志位字段?
如图,现在统计出每个药品的订货次数times,现在想根据times>=2的把IScommon变为true,times<2的IScommon变为false
应该怎么写SQl语句呢?
[解决办法]
update tb set iscommon=case when times>=2 then true when times<2 then false else NULL END
[解决办法]
;with t as(--你的统计语句)update t set iscommon=case when times>=2 then 'true' else 'false' end