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.
Author |
Topic |
cool.mugil
Starting Member
32 Posts |
Posted - 2008-04-16 : 06:48:07
|
hai, my table structure is as follows,mon tue wed thu fri sat sun 1 2 0 0 1 3 4i need to count how many times zero occurs between the given two dates.say for example i need to count how many times zero occur between 01/04/2008 to 31/04/2008.thanks in advance |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-16 : 06:53:57
|
where are the dates stored? i can see only day info in your table. |
 |
|
cool.mugil
Starting Member
32 Posts |
Posted - 2008-04-16 : 07:04:28
|
i does not have dates stored.it have only day info.it is the problem |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-16 : 07:10:29
|
What does those figure suggest? is it for a period like month, week ..? |
 |
|
cool.mugil
Starting Member
32 Posts |
Posted - 2008-04-16 : 07:22:16
|
it is for a week |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-16 : 07:30:47
|
then how would you distingusih which rows correspond to which week? |
 |
|
cool.mugil
Starting Member
32 Posts |
Posted - 2008-04-16 : 07:39:57
|
sorry.it is for a month.my table will be as follows,my table structure is as follows,mon tue wed thu fri sat sun date1 2 0 0 1 3 4 01/04/2008 |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-04-16 : 08:43:44
|
Somwthing likeselect date,count(val) as val from(select date,mon as val from tableunion allselect date,tue as val from tableunion allselect date,wed as val from tableunion allselect date,thu as val from tableunion allselect date,fri as val from tableunion allselect date,sat as val from tableunion allselect date,sun as val from table) as twhere val=0group by dateMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|