I am creating one application in ado.net. In this application I create one Excel file which is sent to the client side. In that Excel file I have patient data. My problem is I want to show only the latest data which is entered between Monday and Saturday. There should not be showing any previous data entered (by? ... about) user. Any tips or an idea would really be appreciated. Below I show you my table structure:
RNo RDate PName DOB CNo Occupation Sex
1 10/01/2013 Mr. Akshay Dighe 05/10/1987 45444 abc male
2 11/01/2013 ms. kavita 06/04/1987 6565 abc female
Desired output:
RNo RDate PName DOB CNo Occupation Sex
1 11/01/2013 ms. kavita 06/04/1987 6565 abc female
2 10/01/2013 Mr. Akshay Dighe 05/10/1987 45444 abc male
Hope you are all getting my point. What I want to say. Exactly.
I wrote one sql query but it is not working. The error message tells me:
'RDate' is not a recognized datepart option
Here is my query:
SELECT p1.PName,p1.RDate,p1.CNo,p1.Sex,p2.ww FROM Physio_cureTable p1
INNER JOIN(SELECT MAX(RDate)mxdate,DATEPART(RDate,RDate)ww
FROM Physio_cureTable
GROUP BY DATEPART(RDate,RDate))p2
ON p1.RDate=p2.mxdate
AND datepart(RDate,p1.[RDate])=t2.ww