I want to fetch Sum of age and total users which are active from users
table and total number of png pictures from pictures
table. I tried the following but it is giving me error. How can i do this in single query? I'm using PDO
SELECT
(SELECT SUM(age) AS age_sum,COUNT(*) AS total FROM users where type='active'),
(SELECT COUNT(*) AS pictotal FROM pictures where extension='png')
SELECT
AA.age_sum, AA. total, BB.pictotal
FROM
(SELECT SUM(age) AS age_sum,COUNT(*) AS total FROM users where type='active') AA,
(SELECT COUNT(*) AS pictotal FROM pictures where extension='png') BB
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments