I have this query.
I would like to to group the result by getting userid and albumtemplateid only, but and the cardtenplateid column I would like to get one of many values that the column have.
Select
UserID,
CardTemplateID,
AlbumTemplateID
from vwCardsPerUser
I don’t know if i made myself clear but here is a example:
userid cardtemplateid albumtemplateid
1 3 1
2 2 1
1 7 1
3 3 2
so the result would be:
userid cardtemplateid albumtemplateid
1 3 1
2 2 1
3 3 2
Since you didn’t specify which “one of many”
cardtemplateidvalues you’d want returned, I arbitrarily chose to select the minimum value.EDIT Based on the question in the comment, this handles the case where cardtemplateid is a uniqueidentifier data type: