1. First() Function :
In MS Access, the First() function is used to return a field value from the first record in the result set returned by a query.
Syntax :
Table – Employee_Details
Example-1 :
Example-2 :
2. Last() Function :
In MS Access, the Last() function is used to return a field value from the last record in the result set returned by a query.
Syntax :
Example-2 :
First(expr)Parameter :
- expr : It represents a string expression identifying the field that contains the data we want to use or an expression that performs a calculation using the data in that field.
| Emp_id | Emp_Name | Experience |
|---|---|---|
| 101 | Amit | 5 |
| 102 | Rahul | 10 |
| 103 | Suhani | 8 |
SELECT First(Emp_id) AS EmployeeId FROM Employee_Details;Output :
| EmployeeId |
|---|
| 101 |
SELECT First(Emp_Name) AS FirstEmployee FROM Employee_Details;Output :
| FirstEmployee |
|---|
| Amit |
Last(expr)Parameter :
- expr : It represents a string expression identifying the field that contains the data we want to use or an expression that performs a calculation using the data in that field.
SELECT Last(Emp_id) AS EmployeeId FROM Employee_Details;Output :
| EmployeeId |
|---|
| 103 |
SELECT Last(Emp_Name) AS LastEmployee FROM Employee_Details;Output :
| LastEmployee |
|---|
| Suhani |