I am trying to send out an email to users who have outstanding issues within the trouble ticketing system. I want to use sp_send_dbmail
The query below selects the criteria for the emails; however if a user has multiple issues I want to group them into one email. The users.email is the email address and the issues.issuenbr is the unique identifier for the issue.
select users.email,issues.issuenbr,issues.issuedescription from issues (nolock)
join users (nolock) on issues.submittedby = users.userid
where issuesolution is NULL and substatusID = 11
Any assistance is appreciated.