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 |
|
molebrain
Starting Member
18 Posts |
Posted - 2005-08-01 : 15:53:10
|
| I have a simple SQL question for ya. I have this table: tblStudentFormID:int,Name:varchar,Locationid:int,Date: datetimeI want it to ouput the number of inquiries for each location between a certain datelike this:Locationid Number of Inquiries0 3001 1232 433 2327 ….9 ….Im guessing this uses the group by and stuff… any ideas? I cant seem to get it to work.This is what I have tried:select StudentlocationId, count(*)as 'Total Inquiries' from tblStudentForm where (StudentFormTimeStamp > 6 / 31 / 2005)group by StudentLocationIDwhich ends up looking like this:StudentlocationId Total Inquiries ----------------- --------------- 0 5241 237342 170863 117384 123725 175936 10096They look like total for the year numbers, not for the month.Any help is appreciated.Thanks! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-08-01 : 15:56:33
|
| Please post what you have tried as this is a pretty basic question. Instead of us answering the question which it sounds like is a homework question, you'd be better off learning the simple stuff. We'll help you if we see you have the wrong answer.Other SQLTeamers, please do not answer this question until the poster has at least showed us he/she has tried.Tara |
 |
|
|
molebrain
Starting Member
18 Posts |
Posted - 2005-08-01 : 16:18:27
|
quote: Originally posted by tduggan Please post what you have tried as this is a pretty basic question. Instead of us answering the question which it sounds like is a homework question, you'd be better off learning the simple stuff. We'll help you if we see you have the wrong answer.Other SQLTeamers, please do not answer this question until the poster has at least showed us he/she has tried.Tara
I'm an idiot. got it working. Sorry for the post.select studentlocationid, count(*) from tblStudentFormwhere StudentFormTimeStamp between '7/1/2005' and '7/31/2005'group by studentlocationidorder by studentlocationid,count(*) |
 |
|
|
|
|
|