Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to find the count of patients between two date

Author  Topic 

krishna.kanigelpula
Starting Member

5 Posts

Posted - 2011-07-16 : 04:04:17
Hi Team,

I have the following columns in my database in one table.

A patinet can change multiple centers. The following is a sample of a patient data

Pno EnterDate Exitdate Center
abc 01/01/2010 01/02/2010 Sydney
abc 02/02/2010 25/03/2010 NY
abc 26/03/2010 09/06/2010 California

I want count of all patients in the centre "NY" on 20/01/2010 date.

Please advise the SQl to get that information.

Thanks
Krishna.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-16 : 04:22:52
[code]
select count(*)
from onetable
where Center = 'NY'
and EnterDate <= '2010-01-20'
and ExitDate >= '2010-01-20'
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

krishna.kanigelpula
Starting Member

5 Posts

Posted - 2011-07-16 : 21:14:48
Thanks for your reply.
Go to Top of Page
   

- Advertisement -