View Single Post

   
  #4 (permalink)  
Old 03-01-2008, 03:49 PM
rui dias
 
Posts: n/a
Default Re: Query - select common data from one column and display in severalcolumns

On Feb 28, 11:56 am, Mark <markc...@hotmail.com> wrote:
> select Name,
> sum(case when note=5 then 1 else 0 end) as note5,
> sum(case when note=4 then 1 else 0 end) as note4
> from mytable
> group by Name


Hello Mark,

Thanks a lot for your answer.

It is really nice!
I didn't know the command "case when filed=value then X else Y end"

Really nice!
Reply With Quote