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.
| ID | Val |
| 1 | 10 |
| 2 | 30 |
| 3 | 29 |
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaimin ShethiyaPosted Nov 13, 2019, 11:44 PM
can you please try below script and let me know it's working or not.
You have wrong write the group by statement.
group by id means they have grouping the id wise and shows the max id is 3 and value is 29 so result is showing 29.
Thanks.
Mageshwaran RPosted Nov 13, 2019, 5:42 AM
Jayesh VaghasiyaPosted Oct 26, 2018, 7:34 AM
Laxmidhar SahooPosted Sep 29, 2018, 9:03 AM
Suraj KumarPosted Sep 27, 2018, 2:06 AM