Quote:
I didn't know the command "case when filed=value then X else Y end" |
Note that a SQL CASE is an expression rather than a command (as in some
other languages). You can use it where expressions are allowed in SQL.
--
Hope this helps.
Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/
"rui dias" <rldias (AT) gmail (DOT) com> wrote
Quote:
On Feb 28, 11:56 am, Mark <markc... (AT) hotmail (DOT) 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!  |