I am trying to basically get all the tags for a specific merchant, and I am hoping to group the tags based on the merchant id (see below for what I'm getting with the current query and what I'm hoping to get). One merchant could have multiple of tags, but each row for Tag only has one merchant. Also merchants and tags are associated through a table merchanttags which just holds the id of the tag and the id of the merchant.
Query
select m.MerchantId, m.MerchantName, t.TagName
from Merchant m
inner join MerchantTags mt on m.MerchantId=mt.MerchantId
inner join tag t on mt.TagId=t.TagId
where m.MerchantId=162
Result
MerchantId | MerchantName | TagName
162 | merchant | tag1
162 | merchant | tag2
Desired Result
MerchantId | MerchantName | TagName | TagName
162 | merchant | tag1 | tag2
Or
MerchantId | MerchantName | TagName
162 | merchant | tag1, tag2