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
 General SQL Server Forums
 New to SQL Server Programming
 how i get previous dates in a table

Author  Topic 

sow
Starting Member

1 Post

Posted - 2011-11-29 : 08:01:43
how i get previous dates count of employee present for each date
/ or
how i get count of employee presented dates in the table
like this
01/10/2011 to 31/10/2011

--
--
01/10/2011 if substitute present like 9316 datecolumn dispaly firstday
02/10/2011 display 1 day present like 1
03/10/2011 (absent like -1) and display 2 days prest like count 2
04/10/2011 like 2
-
-
-
-15/10/2011 count like 10 days
-
-
-21/10/2011 count is 12 days

like end date
with in the table we have find that count of present days


sow

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-11-29 : 08:06:55
something like this

select date, (select count(*) from some_table x where x.date <= t.date)
from some_table t



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

Go to Top of Page
   

- Advertisement -