0
我在社交網站上工作,我有3個SQL表來搜索用戶的建議。例如: 用戶必須在註冊時選擇一個類別。如何根據SQL Server 2005中的興趣過濾建議用戶?
用戶表:
userID | username | categoryID | createdOn
101 abc 2 20-07-11
.....像明智
分類表
CategoryID | CategoryName
0 Health
1 IT
2 Construction
.....像明智
,另一臺是興趣類別, 用戶必須至少選擇5個興趣點,如下所示
個InterestCategories
UserInterestID | UserID | location | CategoryID | CreatedBy
0 101 India 1 101
1 101 UK 3 101
2 101 CA 10 101
3 101 RA 14 101
4 510 LA 5 510
現在我想通過
- 用戶從興趣類別的
- 用戶從我自己的類別
我們如何讓所有建議用戶獲得用戶訂單根據上述使用SQL Server 2005腳本的條件?
你好,我想這兩個點應該是在一個查詢中沒有單獨的查詢 –
你可以使用union聯合這兩個sql。 – ControlPower