Click here to Skip to main content
15,891,033 members
Home / Discussions / Database
   

Database

 
QuestionProblem using FillSchema Pin
FerJones13-Jun-08 14:23
FerJones13-Jun-08 14:23 
QuestionStored Procedure not working with parameters as sort order Pin
Brendan Vogt13-Jun-08 2:22
Brendan Vogt13-Jun-08 2:22 
AnswerRe: Stored Procedure not working with parameters as sort order Pin
SomeGuyThatIsMe13-Jun-08 2:29
SomeGuyThatIsMe13-Jun-08 2:29 
AnswerRe: Stored Procedure not working with parameters as sort order Pin
Ashfield13-Jun-08 2:37
Ashfield13-Jun-08 2:37 
AnswerRe: Stored Procedure not working with parameters as sort order Pin
Alsvha13-Jun-08 3:03
Alsvha13-Jun-08 3:03 
GeneralRe: Stored Procedure not working with parameters as sort order Pin
Ashfield13-Jun-08 3:56
Ashfield13-Jun-08 3:56 
Questionproblem in creating sql reports in asp.net Pin
prakss13-Jun-08 1:51
prakss13-Jun-08 1:51 
QuestionSQL Query - If condition Pin
aaraaayen12-Jun-08 20:56
aaraaayen12-Jun-08 20:56 
Hi Friends,

I am using SQL Server 2005. I am facing the following problem. I need to know how to apply if condition in query.

I am having one table called Test1 with two fields c_name, average.

CC 7
CC 6
CC 8
IGC 2
IGC 4
IGC 6
HC 4
HC 5
NM 9
NM 6
NC 2
NC 5
NC 9
JC 4
JC 3
JC 1

The above are the values in that table.

Now I am using the following query to display the c_name, count(college) with average >5 group by c_name

select c_name,count(c_name) as Total from test1
where average>5 group by c_name


Result :

CC 3
IGC 1
NC 1
NM 2

Based on my query I am getting the above result. In the above result the colleges HC and JC are not coming because it has average only less than 5. But for my case, I want to display the college name with the total as 0 if that college doesnt have average >5. I need to modify the above query to get the result like below.

CC 3
IGC 1
NC 1
NM 2
HC 0
JC 0

Please help for this.

Thanks in Advance,

Regards,
AnswerRe: SQL Query - If condition Pin
Ashfield12-Jun-08 21:08
Ashfield12-Jun-08 21:08 
GeneralRe: SQL Query - If condition Pin
aaraaayen12-Jun-08 21:38
aaraaayen12-Jun-08 21:38 
GeneralRe: SQL Query - If condition Pin
Ashfield12-Jun-08 21:39
Ashfield12-Jun-08 21:39 
QuestionRestore backup from sql server 2005 to 2000 Pin
PrakashBhaskar12-Jun-08 19:56
PrakashBhaskar12-Jun-08 19:56 
AnswerRe: Restore backup from sql server 2005 to 2000 Pin
Parwej Ahamad12-Jun-08 20:48
professionalParwej Ahamad12-Jun-08 20:48 
AnswerRe: Restore backup from sql server 2005 to 2000 Pin
Mycroft Holmes12-Jun-08 20:49
professionalMycroft Holmes12-Jun-08 20:49 
QuestionError in Mail Triggering Pin
sabaMCA12-Jun-08 11:54
sabaMCA12-Jun-08 11:54 
AnswerRe: Error in Mail Triggering Pin
Parwej Ahamad12-Jun-08 17:43
professionalParwej Ahamad12-Jun-08 17:43 
QuestionSql cursor problem... Pin
tthellebuyck12-Jun-08 4:38
tthellebuyck12-Jun-08 4:38 
AnswerRe: Sql cursor problem... Pin
A Wong12-Jun-08 4:47
A Wong12-Jun-08 4:47 
GeneralRe: Sql cursor problem... Pin
tthellebuyck12-Jun-08 5:08
tthellebuyck12-Jun-08 5:08 
AnswerRe: Sql cursor problem... Pin
Mark J. Miller12-Jun-08 7:46
Mark J. Miller12-Jun-08 7:46 
Questiondata connection and path to be written once Pin
Member 429901311-Jun-08 23:44
Member 429901311-Jun-08 23:44 
AnswerRe: data connection and path to be written once Pin
Ashfield12-Jun-08 0:17
Ashfield12-Jun-08 0:17 
Questionselect two fields that are same from one table Pin
prithaa11-Jun-08 22:35
prithaa11-Jun-08 22:35 
AnswerRe: select two fields that are same from one table Pin
Ashfield11-Jun-08 22:54
Ashfield11-Jun-08 22:54 
GeneralRe: select two fields that are same from one table Pin
prithaa11-Jun-08 23:40
prithaa11-Jun-08 23:40 

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.