Click here to Skip to main content
15,889,281 members
Home / Discussions / Database
   

Database

 
AnswerRe: Deploying SQL Server Pin
Mycroft Holmes30-Mar-09 21:56
professionalMycroft Holmes30-Mar-09 21:56 
QuestionHow to run exe file using xp_cmdshell Pin
Krushna Sahu30-Mar-09 0:08
Krushna Sahu30-Mar-09 0:08 
AnswerRe: How to run exe file using xp_cmdshell Pin
knagnayak30-Mar-09 0:15
knagnayak30-Mar-09 0:15 
GeneralRe: How to run exe file using xp_cmdshell Pin
Krushna Sahu30-Mar-09 2:55
Krushna Sahu30-Mar-09 2:55 
QuestionSQL Server Memory Usage Problem Pin
VikashGohil29-Mar-09 22:16
VikashGohil29-Mar-09 22:16 
AnswerRe: SQL Server Memory Usage Problem Pin
Lambin6-Apr-09 18:24
Lambin6-Apr-09 18:24 
QuestionService Account - Account Name Pin
sawerr29-Mar-09 6:57
sawerr29-Mar-09 6:57 
Questionsql noob question on COUNT Pin
Eytukan29-Mar-09 4:12
Eytukan29-Mar-09 4:12 
A simple table:
create table temptable(userid int,username varchar(100),score int)

Values inserted:

insert into temptable values(1,'BOB',17)
insert into temptable values(1,'BOB',21)


Test:
select * from temptable where userid =1


Result:
1,BOB,17
1,BOB,21
Returns 2 rows. Fine.


The requirement: Find number of times BOB has scored above 20.
Expected result
1,BOB,1 //Where the last "1" says that he's got 1 score above 20 (the count)


My attempt:
select userid,username,count(*) from temptable where userid=1 group by userid,username


Here how do I specify a condition for the "Count()"? It just need to count score>20 for BOB.

I'm a rock bottom sql noob. Any help?

He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

AnswerRe: sql noob question on COUNT Pin
ed575629-Mar-09 4:24
ed575629-Mar-09 4:24 
GeneralRe: sql noob question on COUNT Pin
Eytukan29-Mar-09 4:29
Eytukan29-Mar-09 4:29 
GeneralRe: sql noob question on COUNT Pin
ed575629-Mar-09 6:54
ed575629-Mar-09 6:54 
GeneralRe: sql noob question on COUNT Pin
Eytukan29-Mar-09 7:00
Eytukan29-Mar-09 7:00 
GeneralRe: sql noob question on COUNT Pin
ed575629-Mar-09 16:45
ed575629-Mar-09 16:45 
GeneralRe: sql noob question on COUNT Pin
Eytukan29-Mar-09 19:18
Eytukan29-Mar-09 19:18 
GeneralRe: sql noob question on COUNT Pin
Eytukan29-Mar-09 6:16
Eytukan29-Mar-09 6:16 
GeneralRe: sql noob question on COUNT Pin
Eytukan29-Mar-09 6:48
Eytukan29-Mar-09 6:48 
AnswerRe: sql noob question on COUNT Pin
Jörgen Andersson29-Mar-09 8:48
professionalJörgen Andersson29-Mar-09 8:48 
GeneralRe: sql noob question on COUNT Pin
Eytukan29-Mar-09 19:18
Eytukan29-Mar-09 19:18 
AnswerRe: sql noob question on COUNT Pin
anup keshari30-Mar-09 5:04
anup keshari30-Mar-09 5:04 
GeneralRe: sql noob question on COUNT Pin
Eytukan30-Mar-09 5:08
Eytukan30-Mar-09 5:08 
GeneralRe: sql noob question on COUNT Pin
anup keshari30-Mar-09 5:28
anup keshari30-Mar-09 5:28 
AnswerRe: sql noob question on COUNT Pin
i.j.russell30-Mar-09 10:48
i.j.russell30-Mar-09 10:48 
QuestionQuery (find max from two table resultant row should be single in sql 2005) Pin
azad yadav28-Mar-09 21:43
azad yadav28-Mar-09 21:43 
AnswerRe: Query (find max from two table resultant row should be single in sql 2005) Pin
Reza Raad28-Mar-09 21:48
Reza Raad28-Mar-09 21:48 
AnswerRe: Query (find max from two table resultant row should be single in sql 2005) Pin
anup keshari30-Mar-09 5:11
anup keshari30-Mar-09 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.