0
需要幫助我的新的Asp.net 現在我想嘗試啓動社交網絡項目解決SQL
我有3個表
用戶
用戶ID -Username - 電子郵件 -Password 雜牌 -Profilepic
後
-Postid -content -Postdate -userid
好友列表
Friendlistid - 用戶ID - friendid -status
我要加載的職位,來自我的朋友和我自己
這是我的SQL代碼
select b.userid, a.Friendid, c.name, b.postid, b.Content, b.postdate, c.profilepic
from friendlist a
left join [user] c on a.friendid = c.userid
left join post b on a.friendid = b.userid
where a.userid = 1 AND a.Status = 1 OR a.Userid = 1
ORDER BY postid desc
,我遇到了我的帖子會重複
例如,我的好友列表表中有3個朋友,我的每一個職位將重複3次和我的朋友後的問題保持正常。
此sql代碼的任何解決方案?
你需要多個查詢的分組。 – SLaks
**不要以純文本**存儲密碼。 – SLaks