Iam using ms sql server.Iam using a hospital management system .I need to find the last visit of the patient,only the last visit date,How can i do that?I think that it is as same as the latest published text,one of my friend told me,But how can i do that? PLz help me,a help is more appreciated,Thanks in adv

I think you have to change your datatype date into timestamp.By selecting maximum timestamp , you can find the last visited patient.

For example -
Name ID(timestamp)

'a', '2010-09-08 10:43:20'
'b', '2010-09-08 10:44:17'
'c', '2010-09-08 10:44:37'
'd', '2010-09-08 10:44:44'
'e', '2010-09-08 10:44:50'
'f', '2010-09-08 10:44:57'
'a', '2010-09-08 10:45:02'
Now I can find entered name in my database on the same date. query will be like-
select name,id from p where id=(select max(id) from p);

Thanks for the reply
I am not asking the last visited patient but the last visit of the particular patient for example i have to find the last visit of the patient named 'Ram'.Since the consulting fee is remitted once for 20 days

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.