Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT user_Id, user_Fullname,
- DesignationList, CompanyList
- FROM
- (
- SELECT
- user_Id, user_Fullname, user_Zip ,user_Need,
- STUFF(
- (SELECT ', ' + Designation
- FROM UserProfession
- WHERE Prof_ID = a.user_Id
- FOR XML PATH (''))
- , 1, 1, '') AS DesignationList,
- STUFF(
- (SELECT DISTINCT ', ' + Company
- FROM UserProfession
- WHERE Prof_ID = a.user_Id
- FOR XML PATH (''))
- , 1, 1, '') AS CompanyList
- FROM UserBasics AS a
- GROUP BY user_Id, user_Fullname, user_Zip ,user_Need
- ) s
- WHERE (@Zip IS NULL OR user_Zip LIKE '%'+@Zip+'%') AND
- (@Interest IS NULL OR user_Need LIKE '%'+@Interest+'%') AND
- (@Company IS NULL OR CompanyList LIKE '%'+@Company+'%') AND
- (a.user_Id != @CurrentID) AND
- (@Designation IS NULL OR DesignationList LIKE '%'+@Designation+'%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement