RIAS
asked on
Sql Query
Hello,
I have a sql query
Please refer :
https://www.experts-exchange.com/questions/28994771/Sql-query.html
https://www.experts-exchange.com/questions/28995976/Sql-Query.html
Needed change is
There is one more field Extented .
Now if the extended has a date in it then the departure date is replaced by 'Extended'.
Any suggestions are welcome
I have a sql query
DECLARE @Last_Friday AS DATE = '2017-02-07'
DECLARE @This_Friday as date = '2017-02-17'
SELECT GuestName, ArrivalDate, DepartureDate
FROM CORRESPONDENCE
WHERE (ArrivalDate >= '2016-01-01'
AND (DepartureDate >= @Last_Friday)
AND (ArrivalDate >= @Last_Friday AND ArrivalDate < @This_Friday)
OR (ArrivalDate < @Last_Friday AND DepartureDate >= @This_Friday))
Please refer :
https://www.experts-exchange.com/questions/28994771/Sql-query.html
https://www.experts-exchange.com/questions/28995976/Sql-Query.html
Needed change is
There is one more field Extented .
Now if the extended has a date in it then the departure date is replaced by 'Extended'.
Any suggestions are welcome
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Vitor,
Do you say Nakul's solution will not work?
Do you say Nakul's solution will not work?
Do you say Nakul's solution will not work?No. I'm sure it will work.
I just gave an alternative in case you do not want to use the ISNULL function since it may have performance impact if the Extended date is indexed.
ASKER
Cheers!
ASKER