我必須使用count和group,我有點困惑。mysql query select count
我有2個表:
users
id_user | firstname | lastname | genre | logo_src
和
user_stalking
user_id | user_stalking_id
此刻,我的查詢是這樣的:
SELECT us.user_id, us.user_stalking_id, us.notification_viewed, u.id_user,
u.firstname, u.lastname, u.logo_src, u.genre, us.id, us.date
FROM users u, user_stalking us
WHERE us.user_id = ".$_SESSION['user']['id_user']."
AND us.notification_viewed = 0
AND us.user_stalking_id = u.id_user
ORDER BY us.date DESC
,並返回:
John | Jonson | image1.png | male
現在我想收到的所有行的計數包含它們在同一個ID user_stalking.user_id
和user_stalking.user_stalking_id
字段。
什麼是用戶跟蹤,聽起來令人毛骨悚然? – allen213