Max Vs Last in SQL Statement

Posted by Naraayanan under Sql Server on 7/16/2012 | Points: 10 | Views : 3777 | Status : [Member] | Replies : 2
Hi,
Please explain me, What is the Difference between Max and Last in SQL Statement? With example. and Where to use Max and last.

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/



Responses

Posted by: Ranjeet_8 on: 7/16/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
The MAX function returns the maximum value of an expression
The LAST function returns the Last value of row

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhsinathk on: 9/4/2012 [Member] Bronze | Points: 25

Up
0
Down
MAX is used for finding maximum value
SELECT MAX(NUMBERS) FROM TABLE1

LASt is used for finding last value
SELECT TOP 1 * FROM table_Name ORDER BY unique_column DESC



Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response