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 2000 Forums
 SQL Server Development (2000)
 Doing a Sub Count

Author  Topic 

maheshharvey
Starting Member

3 Posts

Posted - 2004-07-23 : 14:18:06
Hi

I need to do a subcount based on a condition.
Heres the scenario, In a given day a web site visitor can post can number of tickets for that site.
Now i need to write a query which will give the number of tickets posted for each day between a given date range.

so i need to do when the user specifies two dates i need to display along with the details no of ticket created on each day frm the date1 to date2 specified by the user . i used couont function but its giving me the count of all the tickets between the dates specifed and not for each day


Mahesh Sundararaman

Mahesh Sundararaman

rlahoty
Starting Member

11 Posts

Posted - 2004-07-23 : 14:23:16
Select day, countoftickets
from yourwebsite
group by day
Go to Top of Page

maheshharvey
Starting Member

3 Posts

Posted - 2004-07-23 : 14:26:00
can i direclty do it

Select day,Count(ticket) from tblName group by day

Mahesh

Mahesh Sundararaman
Go to Top of Page

maheshharvey
Starting Member

3 Posts

Posted - 2004-07-23 : 14:33:07
i need it between 2 dates not days



Mahesh Sundararaman
Go to Top of Page

rlahoty
Starting Member

11 Posts

Posted - 2004-07-23 : 15:11:54
Select day, countoftickets
from yourwebsite
where day between <begin_date> and <end_date>
group by day

use your real column names and you should be good to go.
Go to Top of Page
   

- Advertisement -