道歉,如果我錯了,我有我的數據庫3
表的名字user
,view_history
,online_status
條件在MySQL查詢
用戶
user_id first_name last_name
2 jhon watson
4 boob hasel
5 hena Montena
view_history
user_id pv_user_id
4 2
5 2
online_status
user_id
4
簡介:
1)user table is user basic information of user,
2)view_histroy table is profile viewer,that is by above `view_history` table user `4` had looked into user `2` profile etc.
3)online_status table with one column user_id consist records of user id's who are online, if they are offline then record will be deleted.
所以,現在我想查詢,列出誰一直看着2
個人資料與在線狀態 我寫了下面的查詢:
SELECT
view_history.user_id,
view_history.pv_date,
user.first_name,
user.last_name,
online_status.user_id
FROM
view_history,
user,
online_status
WHERE
view_history.user_id = user.user_id
AND online_status.user_id = user.user_id
AND view_history.pv_user_id = 2
,但我沒有得到用戶5
誰在線的信息。 幫幫我!感謝提前
你能告訴我查詢嗎.. – 2012-03-01 14:10:09
謝謝波希米亞人 – 2012-03-01 14:15:14