Jump to content

[SOLVED] SUM of two select results


The Little Guy

Recommended Posts

I thought that this would work... but it doesn't, I would like to get a total from both returned results, basically this should always return one row and one column. It should contain a number 0+.

 

SELECT SUM((SELECT COUNT(m.id) FROM mailbox m WHERE m.status = '0')
UNION
(SELECT COUNT(f.id) FROM friends f WHERE f.acc = '0')) as total

 

How could I fix it?

Link to comment
https://forums.phpfreaks.com/topic/151150-solved-sum-of-two-select-results/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.