⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 检测某一种附件代理总共领了多少货,销了多少,退了多少.sql

📁 手机进销存系统Delphi源码,管理手机的进货还有销售方面的功能
💻 SQL
字号:
/**********************************
检测某一种附件代理总共领了多少货,销了多少,退了多少

**********************************/

declare @fpjzl char(5)
declare @count int
declare @exist  int--返回值
declare @fl	int
declare @fx	int
declare @ft	int
declare @gt     char(4)

set @fpjzl='%%'
set @gt='gt03'

set @count=(
select count(*) 
from tglfj
where fpjzl  like ltrim(rtrim(@fpjzl)) and substring(fid,1,2)='FL' and fgt like ltrim(rtrim(@gt))
)
if @count=0 
	begin
	set @exist=0
	
	end

if @count>0 
	begin
		set @exist=1	
		--得到领货
		set @fl=isnull((select sum(fnum) from tglfj where fpjzl  like ltrim(rtrim(@fpjzl)) and substring(fid,1,2)='FL'  and fgt like ltrim(rtrim(@gt))),0)
		--得到销售
		set @fx=isnull((select sum(fnum) from tglfj where fpjzl  like ltrim(rtrim(@fpjzl)) and substring(fid,1,2)='FX'  and fgt like ltrim(rtrim(@gt))),0)
		--得到退货
		set @ft=isnull((select sum(fnum) from tglfj where fpjzl  like ltrim(rtrim(@fpjzl)) and substring(fid,1,2)='FT'  and fgt like ltrim(rtrim(@gt))),0)
	end



select @exist,@fl as fl,@fx as fx,@ft as ft
select * from tglfj
--where fpjzl  like ltrim(rtrim(@fpjzl))




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -