Skip to content
Advertisement

Count sum of two columns

I am trying to count the sum of 2 columns from a subset of results, so far I have put this together

What I am expecting as output is the number of cases where the sum is >=3, so as an example 5

At the moment I get the error

I feel I am on the wrong path though. How can I construct this query please

Advertisement

Answer

You are not giving a value for the IN statement, which returns a boolean stating if a value is within the results of your SELECT statement

The easiest change to your query for it to work would be:

However, the correct approach in case that table_name is actually used twice would be:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement