I have a problem to get the max and the min value, I want the result to be XXL and XXS
SELECT MAX(tblSizeXL.SizeXLName) AS maxSize,
MIN(tblSizeXL.SizeXLName) AS minSize
FROM Product
JOIN tblSizeXL ON Product.SizeXLID = tblSizeXL.SizeXLID
WHERE (Product.GroupID = @GroupID)
GROUP BY tblSizeXL.SizeXLID
ORDER BY tblSizeXL.SizeXLID DESC
tblSize
SizeXLID SizeXLName
-----------------------
1 XXS
2 XS
3 S
4 M
5 L
6 XL
7 XXL
8 XXXL