我想根据一个查询中的条件将升级或标准的用户计入users['upgraded']或users['standard']变量。我正在使用 mysql 和 PDO。“id”是主键
像这样的东西:
$user[upgraded] =
SELECT COUNT(*)
FROM users
AS upgraded
WHERE (status1 > 0 OR status2 > 0 OR status3 > 0)
AND upgraded = 1
AND paused = 0
AND timestamp < $timestamp
ORDER BY id DESC
和
$user[standard] =
SELECT COUNT(*)
FROM users
AS standard
WHERE (status1 > 0 OR status2 > 0 OR status3 > 0)
AND upgraded = 0
AND paused = 0
AND timestamp < $timestamp
ORDER BY id DESC
我如何在一个查询中得到这个?帮助将不胜感激!