user1256477
user1256477

Reputation: 11201

count first value, second value or both

I need to do a count, if the first or the second value is true, it should be one, and if both are correct, the value should be two:

 select count(*) from table1 where (cond1 or cond2)

it should be something like this, but I cant get it.

How can I do it?

Thank you in advance

Upvotes: 1

Views: 105

Answers (1)

eggyal
eggyal

Reputation: 125855

SELECT SUM(cond1) + SUM(cond2) FROM table1 WHERE cond1 OR cond2

Upvotes: 2

Related Questions