Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a table like this...
-----INPUT-----
medicareid   firstservicedate
1             2017-01-10
2             2017-08-11
3             2017-09-10
4             2017-09-05
5             2017-09-25
6             2017-09-26
7             2017-09-26
8             2017-09-27
9             2017-09-30
10            2017-10-01

-----OUTPUT-----
medicareid firstservicedate
-----------   ----------------
6             2017-09-26
7             2017-09-26
8             2017-09-27
9             2017-09-30
10            2017-10-01


What I have tried:

Yesterday Interview person asked me to fetch the data according to dates...I tried different date function like dateadd datediff etc...but i am not got it..
can anyone help me with this
Posted
Updated 26-Sep-18 22:04pm
v2

To be honest, if you can't do that on your own, then you very definitely aren't ready to enter the job market doing anything to do with databases: that is the result of a very, very basic WHERE clause:
SQL
SELECT medicareid, firstservicedate WHERE firstservicedate >= '2017-09-26'
If you can't do that you need to go right back to the beginning of your course notes as you stand no chance at all of keeping any job you might bluff your way into.
 
Share this answer
 
Comments
Member 13932549 27-Sep-18 4:04am    
Its correct but we should not hardcode it...Can you try with the dynamic way query...
OriginalGriff 27-Sep-18 4:05am    
And why don't you?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900