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 |
maheshharvey
Starting Member
3 Posts |
Posted - 2004-07-23 : 14:18:06
|
HiI 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 SundararamanMahesh Sundararaman |
|
rlahoty
Starting Member
11 Posts |
Posted - 2004-07-23 : 14:23:16
|
Select day, countoftickets from yourwebsite group by day |
|
|
maheshharvey
Starting Member
3 Posts |
Posted - 2004-07-23 : 14:26:00
|
can i direclty do itSelect day,Count(ticket) from tblName group by dayMaheshMahesh Sundararaman |
|
|
maheshharvey
Starting Member
3 Posts |
Posted - 2004-07-23 : 14:33:07
|
i need it between 2 dates not daysMahesh Sundararaman |
|
|
rlahoty
Starting Member
11 Posts |
Posted - 2004-07-23 : 15:11:54
|
Select day, countofticketsfrom yourwebsitewhere day between <begin_date> and <end_date>group by dayuse your real column names and you should be good to go. |
|
|
|
|
|