一条sql语句,不知道怎么写啦
一条sql语句,不知道怎么写啦
--SELECT * FROM BS_GoodsInfo 商品信息
一条sql语句,不知道怎么写啦--
GO
一条sql语句,不知道怎么写啦--
SELECT * FROM BS_Customer 客户信息
一条sql语句,不知道怎么写啦--
GO
一条sql语句,不知道怎么写啦--
SELECT * FROM BS_DisSaleSystem  特价促销价格体系
一条sql语句,不知道怎么写啦--
GO
一条sql语句,不知道怎么写啦--
SELECT * FROM BS_DisPriceType 特价促销价格体系类别
一条sql语句,不知道怎么写啦--
GO
一条sql语句,不知道怎么写啦--
SELECT * FROM BS_DisSaleGoods 特价促销价格体系商品
一条sql语句,不知道怎么写啦--
GO
一条sql语句,不知道怎么写啦--
select * from BS_ConPriceSystem  客户合同价格体系表
一条sql语句,不知道怎么写啦--
go
一条sql语句,不知道怎么写啦--
select * from BS_ConPriceType 
一条sql语句,不知道怎么写啦--
go
一条sql语句,不知道怎么写啦--
select * from BS_ConPriceGoods 客户合同价格体系商品
一条sql语句,不知道怎么写啦

一条sql语句,不知道怎么写啦
--go
一条sql语句,不知道怎么写啦
DECLARE @iSDisPrice as int        --这个是为了判断是不是有促销价格
一条sql语句,不知道怎么写啦
DECLARE @iSConPrice as int        --这个是为了判断是不是有合同价格
一条sql语句,不知道怎么写啦
declare @DisPriceDate as int    --这个是为了标志是不是在这个时间范围里.
一条sql语句,不知道怎么写啦
declare @BeforePrice as int        --这个是为了判断是不是上一次价格
一条sql语句,不知道怎么写啦--
这里判断是不是有促销价格
一条sql语句,不知道怎么写啦
SET @iSDisPrice = (SELECT COUNT(*FROM BS_DisSaleSystem where CustID = '8566363' AND CompanyID = '0111102')
一条sql语句,不知道怎么写啦
if @iSDisPrice > 0 
一条sql语句,不知道怎么写啦
begin
一条sql语句,不知道怎么写啦    
--这里判断在这个时间里是不是有促销价格
一条sql语句,不知道怎么写啦
    set @DisPriceDate = (select count(*from BS_DisPriceType where TypeCode in (SELECT TypeCode FROM BS_DisSaleSystem where CustID = '8566363' AND CompanyID = '002'and CompanyID = '002' and frmdate <= getdate() and  getdate()<= ToDate )
一条sql语句,不知道怎么写啦    
if @DisPriceDate > 0
一条sql语句,不知道怎么写啦    
begin
一条sql语句,不知道怎么写啦        
--SELECT * FROM BS_DisSaleGoods where CompanyID = '002'  and TypeCode in (select TypeCode from BS_DisPriceType where TypeCode in (SELECT TypeCode FROM BS_DisSaleSystem where CustID = '8566363' AND CompanyID = '002') and CompanyID = '002' and frmdate <= getdate() and  getdate()<= ToDate )
一条sql语句,不知道怎么写啦
        SELECT isnull(a.conPrice,0as Price, * from View_dSaleBill INNER JOIN (SELECT * FROM BS_DisSaleGoods where CompanyID = '002'  and TypeCode in (select TypeCode from BS_DisPriceType where TypeCode in (SELECT TypeCode FROM BS_DisSaleSystem where CustID = '8566363' AND CompanyID = '002'and CompanyID = '002' and frmdate <= getdate() and  getdate()<= ToDate )) A ON A.CompanyID = View_dSaleBill.CompanyID and a.GoodsID = View_dSaleBill.GoodsID and View_dSaleBill.companyId = '002' 
一条sql语句,不知道怎么写啦
--    goto dis_goto
一条sql语句,不知道怎么写啦
    end
一条sql语句,不知道怎么写啦
end
一条sql语句,不知道怎么写啦
else 
一条sql语句,不知道怎么写啦    
begin
一条sql语句,不知道怎么写啦        
--这里判断是不是有合同价格
一条sql语句,不知道怎么写啦
        SET @iSConPrice = (SELECT COUNT(*FROM BS_ConPriceSystem where CustID = '8566363' AND CompanyID = '002')
一条sql语句,不知道怎么写啦        
if @iSConPrice > 0
一条sql语句,不知道怎么写啦            
begin

 
现在就是在每一次

相关文章:

  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
猜你喜欢
  • 2021-06-30
  • 2021-12-12
  • 2021-11-16
  • 2021-10-29
  • 2022-03-08
  • 2022-02-16
相关资源
相似解决方案