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 |
Diablos
Starting Member
10 Posts |
Posted - 2015-10-29 : 12:57:23
|
HiI'm having problems with the following count:Here is my dataBus Starting Date End Date4561 2015-10-26 00:00:00.000 2015-10-26 00:00:00.0004614 2015-10-28 00:00:00.000 2015-10-28 00:00:00.0004443 2015-10-26 00:00:00.000 2015-10-28 00:00:00.0004521 2015-10-27 00:00:00.000 2015-10-27 00:00:00.0004615 2015-10-28 00:00:00.000 2015-10-28 00:00:00.000I want to know the total number of bus active based on the start and end by day,the result should be - day 26 i have 2 bus active (4561 and 4443) - day 27,the result is 2 (4521 and 4443) - day 28 the result is 3 (4614,4443,4615).i've tried with between but to no result.Thanks for your help!! |
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2016-06-18 : 12:12:05
|
select count (bus), bus from table_name where EndDate between 'mm/DD/yy' and 'mm/DD/yy' group by bus having count (bus)>0http://kiransoftech.com |
|
|
vedjha
Posting Yak Master
228 Posts |
Posted - 2016-06-18 : 12:12:06
|
select count (bus), bus from table_name where EndDate between 'mm/DD/yy' and 'mm/DD/yy' group by bus having count (bus)>0http://kiransoftech.com |
|
|
|
|
|