Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My query as follows;
SQL
select  Distinct Faculty_Name = (select top 1 facname from faculty where facid = bfid), Rating = (case rate when '1' then 'Excellent' when '2' then 'Good' when '3' then 'Fair' when '4' then 'Poor' when '0' then 'Not Applicable' end)

from facfeedback

when i execute the above sql query output as follows;
Faculty_Name      Rating

  Ramesh           Excellent
  Ramesh           Good
  Suresh           Fair
  Suresh           Poor
but using my above query i want to see the particular Faculty_Name rating for that how can i write the query using where condition using above sql query.

suppose i want to see the particular Facutly_Name (Ramesh) for that how can i write the query.

please help me.

Regards,
Narasiman P.
Posted
Updated 6-May-13 2:28am
v2
Comments
Prasad Khandekar 6-May-13 8:49am    
Query does not contain from clause. Does it really works?
skydger 6-May-13 9:36am    
Maybe I don't get it, but do you want something like this?
SELECT Faculty_Name,
CASE MAX(rate) when '1' then 'Excellent'
when '2' then 'Good'
when '3' then 'Fair'
when '4' then 'Poor'
when '0' then 'Not Applicable' end
AS rate
FROM Faculty AS f
WHERE facid = bfid
GROUP BY Faculty_Name

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900