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
Hazel Mahmud
1.4k
315
69.5k
put sql result in 1 row
Oct 24 2016 11:17 PM
hello...
i have sql as below :
SELECT ans_que_id as [QUE ID], ans_answer as Answer, count(*) AS count,
ans_ss_id, ans_term, ans_group_id, ans_cou_id,ans_fr_id,
CASE
WHEN ans_answer = 7 THEN count(*) ELSE 0
END AS C7,
CASE
WHEN ans_answer = 8 THEN count(*) ELSE 0
END AS C8,
CASE
WHEN ans_answer = 9 THEN count(*) else 0
END AS C9,
CASE
WHEN ans_answer = 10 THEN count(*) else 0
END AS C10
FROM [ecevas].[dbo].[answer]
where ans_answer in (7,8,9,10)
AND ans_cou_id = 'STID5014'
AND ans_group_id = 'B'
AND ans_que_id = '7'
group by ans_que_id, ans_answer, ans_ss_id,
ans_term, ans_group_id, ans_cou_id,ans_fr_id
order by ans_que_id, ans_answer
and the result are as image below :
how do i do to make the expected result as below:
please help anyone..if possible with full SQL..
Reply
Answers (
3
)
First character of string
How to find experience of person from date of joining to pre