First image is my query output. Now I want to group the subject so that it become like the second image. Is it possible? Thanks for the help.
select Subject, Grade,
case when Grade >= 50
Then '1'
else '0'
end as Pass,
case when Grade < 50
Then '1'
else '0'
end as Fail
from Grade_report
OUTPUT:

what I want is:

Your specification is not very exact; what number do you expect in the grade on the merged record, and should it just write 1 or 0 or aggregate the sum of the pass and fail columns?
The following will generate your output, it takes the
MAXfor the grade andSUMfor pass/fail information: