Counting values in an array

I have this query which results in an array.


How do I count the values in it?
Because there numbers, array_count_values() doesnt work

What are you actually hoping to get? The sum of the two numbers, or something else?

yes, can I get the sum of the 2 numbers in the array? (884+453)1337

so… you want the sum… of an array…

PHP is very inventive with their naming conventions.

array_sum

3 Likes

Here you go.

SELECT
	sum( EachTableCount ) sum
FROM
	( SELECT count(*) AS EachTableCount 
	FROM chassis_types 
	UNION ALL 
	SELECT count(*) AS EachTableCount FROM blade_server_types
	) tbl;
2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.