5
Answers

Table variable with group by

Sai Reddy

Sai Reddy

6y
517
1
Hi,
 SELECT * FROM TheAssignmentPuzzle
ID Val
1 10
2 30
3 29
 
 
Declare @id int
Select @id=max(vals) from TheAssignmentPuzzle
group by id
select @id
 
It returns 29, but in the table max value is 30. 
Answers (5)