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
I have tried Case When, but I cannot get it to work.
Dates within range
in SQL
Posted
Hi There,
I have the following table that I created from the below query
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
I have tried Case When, but I cannot get it to work.