I know this has a stupid solution but, sorry, I’m little bit confused.
I have two SELECT COUNT statements. Example:
Statement 1
SELECT COUNT(softwareone) AS totalcount
FROM my_table WHERE softwareone LIKE '%typeone%'
totalcount = 3
_
Statement 2
SELECT COUNT(softwaretwo) AS totalcount
FROM my_table WHERE softwaretwo LIKE '%typeone%'
totalcout = 1
I want to sum both totals to get totalcount = 4. There is a way to do that?
Note: software type from columns “softwareone” and “softwaretwo” is of the same type (same value).
Thanks to all.
One way is to write:
The
CASE ... ENDexpression will evaluate to2when both conditions are met (so that ifsoftwareoneandsoftwaretwoare bothLIKE '%typeone%', then the row counts twice), and1when only one of them is. So, theSUM(CASE ... END)gives the total number of rows where the one condition is met, plus the total number of rows where the other condition is met.