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
Ankit Kumar
NA
61
5.7k
Group by not working for subquery please help
Dec 26 2016 4:14 AM
select
M.vch_dmo_name,
count(1) as total,
DATENAME(MM,DTM_REQ_ON) MONTH,
(select count(1) from M_PMS_FormA A where int_status_id=5 and A.int_dmo_id=M.int_dmo_id ) Approved,
(select count(1) from M_PMS_FormA A where int_status_id=3 and A.int_dmo_id=M.int_dmo_id ) Rejected,
(select count(1) from M_PMS_FormA A where int_status_id not in (5,3) and A.int_dmo_id=M.int_dmo_id ) [Progress]
from M_Mining_dmo M inner join M_PMS_FormA A on M.int_dmo_id=A.int_dmo_id group by DATEPART(MM,DTM_REQ_ON),DATENAME(MM,DTM_REQ_ON),vch_dmo_name,M.int_dmo_id
Reply
Answers (
1
)
How to reset password of SQL server account?
How to display current date as given format in SQL SERVER ?