欢迎光临散文网 会员登陆 & 注册

SQL数据库之--浪嘉医药软件--商品状态判断

2022-12-23 21:18 作者:waiter_game  | 我要投稿


case    when a.商品状态 ='停用' then '停用'
                    when a.商品类别 like '%饮片' or a.处方类型 ='非药品' then  '有效'
                    when  (( c1.首营 is null and left(c1.货号,2)='10' )
                    or c2.缺项>=1  or a.经营类别 ='通用' or a.经营类别 is null or a.经营类别 =''
                    or isnull(c2.有效,0)+isnull(c2.近期,0) =0  ) then '暂停'
                    else '有效' end) 状态

-----------------------------------------------------------------       
select 经营类别 from 商品清单 a                     
where  货号='3067770'                  
select * from 商品信息 as h
where  货号='3067770'
select top 10 * from 商品首营 c1
where 货号='3067770' and 属性 ='有效' group by 货号
select 编号,sum(case when 状态='有效' then 1 else 0 end) 有效,    sum(case when 状态='近期' then 1 else 0 end) 近期,
            sum(case when 状态='过期' then 1 else 0 end) 过期,    sum(case when 状态='缺项' then 1 else 0 end) 缺项,
            convert(varchar,isnull(min(效期),'2116-12-04 00:00:00.000'),112) 资质效期,max(档案) 档案编号
from 资质清单 c2
where 编号='3067770' and 类别='商品' group by 编号

select 编号,'有 '+convert(varchar(4),count(1)) 报告 from 文件清单 c3
where 编号='3067770' and 类别='质检报告'  and 状态 = '有效' group by 编号

select 编号,'有 '+convert(varchar(4),count(1)) 文件 from 文件清单 c4
where 编号='3067770' and 类别='商品'  and 状态 ='有效' group by 编号

SQL数据库之--浪嘉医药软件--商品状态判断的评论 (共 条)

分享到微博请遵守国家法律