1.查询某类的供应商信息 ---sql
select distinct su.fnumber,su.fname_l2,cbank.FBank,cbank.FBankAccount,cbank.FBankAddress from T_BD_SupplierCompanyBank cbank
left join T_BD_SupplierCompanyInfo com on cbank.FSupplierCompanyInfoID =com.fid
left join T_BD_Supplier su on su.fid =com.FSupplierID
left join T_BD_CSSPGroup g on g.fid=su.FBrowseGroupID
where g.fnumber in ('05') and cbank.FBankAddress is null;
2.查询系统中所有公司有效的固定资产卡片清单-sql--(与各个公司的固定资清单保持一致)
select org.fnumber 公司编码,org.fname_l2 公司名称,facat.fname_l2 固定资产类别,fa.fnumber 固定资产编码,fa.FAssetName 固定资产名称,
fa.FOldNumber 原资产编码,fa.FAssetAmt 数量,fa.FAssetValue 资产原值 from T_FA_FaCurCard fa
left join t_org_company org on fa.FCompanyID=org.fid
left join T_FA_Cat facat on facat.fid=fa.FAssetCatID
where 1=1
--org.fnumber in ('0101','01001','010600','01060100','0201','020201','010201')
--and fa.FOldNumber not like 'A%' and fa.FOldNumber not like 'T%'
and fa.FDeletedStatus !=2 --非作废状态的单子
and fa.FCheckedStatus=2 --已审核完成的单子
and fa.FEffectedStatus=2 --有效的固定资产卡片
--and org.fnumber in ('T00280002')
order by org.fnumber,facat.fname_l2;
3.人员失效处理sql(备份+执行)
insert into dml_T_ORG_PositionMember select * from T_ORG_PositionMember where fpersonid in (select fid from t_bd_person where fnumber in ('010391'));
delete from T_ORG_PositionMember where fpersonid in (select fid from t_bd_person where fnumber in ('010391'));
4.更新T_ORG_OUPartAdmin表的FResponPositionID字段信息, 根据t_org_admin
update T_ORG_OUPartAdmin set FResponPositionID=(select FResponPositionID from t_org_admin where T_ORG_OUPartAdmin.funitid=t_org_admin.fid
and t_org_admin.fisleaf=1 and t_org_admin.FIsOUSealUp=0 and t_org_admin.FResponPositionID <>T_ORG_OUPartAdmin.FResponPositionID);
5.凭证号是顺序码,按编码排序出现1、11、12等顺序,脚本排序,如下
select p.fnumber,v.fnumber,v.FCreateTime,FBizDate,FBookedDate from t_gl_voucher v
left join T_BD_Period p on v.FPeriodID=p.fid
left join t_org_company org on v.FCompanyID=org.fid
where 1=1
and p.fperiodyear=2014
and p.fperiodnumber in ('5')
and org.fnumber in ('006-01')
order by v.fnumber,p.fnumber;
6.查询几个公司的某一天的凭证数据 ----sql
select * from t_gl_voucher v
left join t_org_company c on c.fid=v.fcompanyid
left join T_BD_Period p on v.FPeriodID=p.fid
left join T_PM_User u on u.fid=v.FCreatorID
where c.fnumber in (
'T00230001','T08340001','T07170001','T00200011')
and p.FPeriodYear=2016 and p.FPeriodNumber=12
and u.fnumber in ('vrms_user')
and to_char( fbizdate,'yyyy-mm-dd')='2016-12-25'
--and fbizdate ='2016-12-22 00:00:00.0'
order by v.FCreateTime desc;