October 1, 2011 at 11:19 am
select
case when Profesenalism=1 then count(Profesenalism) end as 'Profesenalismpoor',
case when profesenalism=2 then count (profesenalism) end 'profesenalismavg',
case when Communication=1 then count(Communication) else 0 end 'Communicationpoor',
case when Communication=2 then count (Communication) else 0 end 'Communicationavg',
case when Customerservice=1 then count(Customerservice) else 0 end 'Communicationpoor',
case when Customerservice=2 then count (Customerservice) else 0 end 'Communicationavg'
from Rating where profileid=101
group by Profesenalism,Communication,Customerservice
please check attachment for query...
out put displaying llike attched output jped..
i need result in one single row.............
October 1, 2011 at 12:01 pm
Not really clear on your question....???
can you please provide script that will create and insert data that represents the problem you have..(see link in my sig if not clear)
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
October 1, 2011 at 3:48 pm
dastagiri16 (10/1/2011)
selectcase when Profesenalism=1 then count(Profesenalism) end as 'Profesenalismpoor',
case when profesenalism=2 then count (profesenalism) end 'profesenalismavg',
case when Communication=1 then count(Communication) else 0 end 'Communicationpoor',
case when Communication=2 then count (Communication) else 0 end 'Communicationavg',
case when Customerservice=1 then count(Customerservice) else 0 end 'Communicationpoor',
case when Customerservice=2 then count (Customerservice) else 0 end 'Communicationavg'
from Rating where profileid=101
group by Profesenalism,Communication,Customerservice
please check attachment for query...
out put displaying llike attched output jped..
i need result in one single row.............
We need some data to show you how to do this. However, don't assume that you know how to post the data. Please read the article at the first link in my signatue line below for how to post data to get the right answer more quickly.
--Jeff Moden
Change is inevitable... Change for the better is not.
October 1, 2011 at 8:32 pm
hi,
my table data is ...
id Profesenalism Communication Customerservice profileid
1001 1 2 1 101
2001 2 1 1 101
the above table 1 and 2 is ratings.. if 1 that is poor and 2 that is avg..i need count of profesenalismpoor ? and count of profesenalismavg ?..like Communicationpoor,Communicationavg,Customerservicepoor,Customerserviceavg.........
i need out put like dis..
Profesenalismpoor profesenalismavg Communicationpoor Communicationavg Customerservicepoor cusavg
1 1 1 1 2 0
I wrote my query like dis..
select
case when Profesenalism=1 then count(Profesenalism) end as 'Profesenalismpoor',
case when profesenalism=2 then count (profesenalism) end 'profesenalismavg',
case when Communication=1 then count(Communication) else 0 end 'Communicationpoor',
case when Communication=2 then count (Communication) else 0 end 'Communicationavg',
case when Customerservice=1 then count(Customerservice) else 0 end 'Customerservicepoor',
case when Customerservice=2 then count (Customerservice) else 0 end 'Customerserviceavg'
from Rating where profileid=101
group by Profesenalism,Communication,Customerservice
it is displaying another extra column.......please advice
October 1, 2011 at 8:55 pm
May be this?
declare @tab Table
( id int,
professionalism int,
communication int,
customerservice int,
profileid int
)
insert @tab( id , professionalism , Communication ,Customerservice ,profileid)
select 1001 ,1 ,2 ,1 ,101
union all select 2001 ,2 ,1 ,1 ,101
Select
ProfessionalismPoor = sum ( case when professionalism = 1 then 1 else 0 end )
, ProfessionalismAvg = sum ( case when professionalism = 2 then 1 else 0 end)
, CommunicationPoor = sum ( case when Communication = 1 then 1 else 0 end )
, CommunicationAvg = sum ( case when Communication = 2 then 1 else 0 end)
, CustomerServicePoor = sum ( case when CustomerService = 1 then 1 else 0 end )
, ProfessionalismAvg = sum ( case when CustomerService = 2 then 1 else 0 end)
from @tab
October 2, 2011 at 12:47 am
hi,
Thanks ..alot.....for u r reply...........Its working ........fine
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply