本文介绍了2015年10月1日至2015年10月1日当天没有记录返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ALTER PROCEDURE [dbo].[DailySummary]
	-- Add the parameters for the stored procedure here
	@StartDate datetime = null,
	@RegionCode varchar(30) = null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.

--Declare @DateA datetime 
--set @DateA=dateadd(hour,00,@StartDate)

Declare @DateB datetime
set @DateB = convert(datetime, convert(Varchar(12), @StartDate, 106) + ' 23:59:59PM')
--set @DateB = DATEADD(minute, txn.59, txn.@StartDate)
--set @DateB = DATEADD(SECOND, txn.59, txn.@StartDate)

	SET NOCOUNT ON;

    -- Insert statements for procedure here
	select distinct txn.Source_GpoName as GPO_Name,count(MoNo) as Total_EMO,Sum(Amount) as EMO_Value , sum(Commision) as Commission,Sum(Amount+ Commision)as Total_Amount
	from  MOTxn txn
	INNER JOIN AllPostOffice AS po ON txn.Source_GpoName = po.Name
	 where EntryDate between --( DATEDIFF(d,@StartDate,MOTxn_txn.EntryDate ) >= 0
  --  AND DATEDIFF(d,@DateB,MOTxn_txn.EntryDate)<= 0) 
   @StartDate and @DateB

	  --convert(date,@StartDate) AND convert(date,DateADD(dd,1,@EndDate))
	  --convert(date,@StartDate) AND convert(date,DateADD(dd,1,@DateB))


	--WHERE  EntryDate Between ( DATEDIFF(d,@StartDate,MOTxn_txn.EntryDate ) >= 0
 --AND DATEDIFF(d,@DateB,MOTxn_txn.EntryDate)<= 0)
 --AND ( EntryDate <> 0 )        
	--and isPaid='0'

	and po.RegionCode LIKE  ISNULL(@RegionCode ,'') + '%'
	group by Source_GpoName
END

推荐答案

WHERE DATEDIFF(d,@startDate,vv_TxnTemp.CreatedOn ) >= 0
			  AND DATEDIFF(d,@endDate2,vv_TxnTemp.CreatedOn)<= 0


@StartDate date
where cast(EntryDate as date) = @StartDate 



这篇关于2015年10月1日至2015年10月1日当天没有记录返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-21 13:57