Sai Reddy

Sai Reddy

  • NA
  • 214
  • 31.2k

Table variable with group by

Sep 27 2018 1:35 AM
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)