MySQL Forums
Forum List  »  Newbie

select statement with condition
Posted by: Schmalzl Anna
Date: October 01, 2014 08:13AM

Hi All,

I read this sql statetement I've never seen before. Is there any documentaion about this feature? Is this sql standard?

select sum(col1 = value1 or col1 = value2) as First, sum(col1 = value2) as Second
from myTable;

The result is the count of rows where the condition is true and boht columns (First and Second) have correct values. Is there another way to select with the same result?

Thanks for your help!
Anna

Options: ReplyQuote


Subject
Written By
Posted
select statement with condition
October 01, 2014 08:13AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.