我有这张桌子:
id | id_user | id_user_stalkers | date
0 | 0222222 | 032332 | 32234234
所以,我想知道我的朋友列表中所有用户的数量,以及我在他们的朋友列表中的所有用户的数量。目前,我做了这个查询:
SELECT (
SELECT COUNT(id_user)
FROM stalkers WHERE id_user = ".$id."
) AS user_stalkers,
(
SELECT COUNT(id_user_stalkers)
FROM stalkers WHERE id_user_stalkers = ".$id."
) AS user_is_stalked
FROM stalkers
但它返回这个:
Array
(
[0] => Array
(
[user_stalkers] => 7
[user_is_stalked] => 2
)
[1] => Array
(
[user_stalkers] => 7
[user_is_stalked] => 2
)
[2] => Array
(
[user_stalkers] => 7
[user_is_stalked] => 2
)
[3] => Array
(
[user_stalkers] => 7
[user_is_stalked] => 2
))
没关系,但我只需要一排,而不是四排。
有人可以帮我吗?