a logic for this using stored procedure mysq [Resolved]

Posted by Sashi under Sql Server on 3/18/2016 | Points: 10 | Views : 394 | Status : [Member] | Replies : 2
when a date is selected ...
i.e. 25/6/2016 - 28/6/2016
So in between there are 26/6/2016, 27/6/2016 ..( 2days)
my question is how to not select those in between 2days . those 2days should not be selected are taken .. if is select 26/6/2016 it should error . how can i write a logic for this using stored procedure mysql?




Responses

Posted by: Rajnilari2015 on: 3/19/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
...
Where DateColumn Not IN('26/6/2016', '27/6/2016')


..Hope you got the logic

--
Thanks & Regards,
RNA Team

Sashi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Professionaluser on: 3/21/2016 [Member] [MVP] Bronze | Points: 25

Up
0
Down

 --Rows which has exact dates as @Date1 or @Date2

DECLARE @Date1 date ='25/6/2016', @Date2 date = '28/6/2016'
SELECT * FROM TableName
WHERE DateColumn = @Date1 or DateColumn=@Date2
GO
--Rows which has dates below 25th June and above 27th June
DECLARE @Date1 date ='25/6/2016', @Date2 date = '28/6/2016'
SELECT * FROM TableName
WHERE DateColumn <= @Date1 or DateColumn>=@Date2


Revert me back if the above solutions not fixed your issue

Sashi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response