Jump to content

Dates within range


Annemie19
 Share

Recommended Posts

Hi There, 

I have the following table that I created from the below query

image.thumb.png.620fda4cb305f34b060fe5585f7efd54.png

 

SELECT
d.DealID, 
d.DealNumber, 
d.NominalAmount, 
--i.StartDate,
DATEADD(day, -1, i.EndDate) AS [AdjustedEndDate], 
i.Rate, 
cp.ProjStartDate, 
cp.ProjEndDate, 
dir.InterestMultiplier 

from [dbo].[VwPrefSharesDeal] d
JOIN VwPrefSharesCashProjection cp on cp.DealHashKey = d.DealHashKey
JOIN [dbo].[VwPrefSharesDealInterBankRelation] dir ON d.DealHashKey = dir.DealHashKey
JOIN [dbo].[VwPrefSharesBank] b ON dir.InterestBankHashKey = b.BankHashKey
JOIN [dbo].[VwPrefSharesInterest] i ON b.BankHashKey = i.BankHashKey

WHERE DealID = 'SI001263-03'
and ProjStartDate = '2020-03-31 23:59:59.0000000'
ORDER BY i.StartDate

 

I want to show the start date as the ProjStartDate = '2020-03-31 23:59:59.0000000' when the ProjStart date is after the startdate and the AdjustedEndDate as and ProjEndDate = '2020-09-30 23:59:59.0000000'. 

For instance, I only want to see the following dates

image.png.1049bfac6d61423f10261687f06be285.png

 

I have tried Case When, but I cannot get it to work. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...