TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Venkatesan
NA
16
6.9k
** Please solve this group by query...
May 23 2013 4:07 AM
1) My Table:
Query: select mcdesp,mcopsts from machine
Table:
mcdesp
mcopsts
A
GOOD
A
GOOD
B
GOOD
C
URWP
C
GOOD
A
URWT
A
URWT
2) My Quries and their outputs:
select mcdesp,count(mcopsts)as TotalMachine from machine group by mcdesp
mcdesp
TotalMahine
A
4
B
1
C
2
select mcdesp, count(mcopsts) as GOOD from machine where mcopsts='GOOD' group by mcdesp
mcdesp
GOOD
A
2
B
1
C
1
select mcdesp,count(mcopsts) as URWT from machine where mcopsts='URWT' group by mcdesp
mcdesp
URWT
A
2
B
C
select mcdesp,count(mcopsts) as URWP from machine where mcopsts='URWP' group by mcdesp
mcdesp
URWP
A
B
C
1
BUT I NEED A RESULT LIKE
mcdesp
TotalMachine
GOOD
URWP
URWT
A
4
2
0
2
B
1
1
0
0
C
2
1
1
0
Please some one help me..
Reply
Answers (
5
)
image url in sql server 2008
SQL SERVER TEMP TABLE