---
title: "How to select the last row of a particular CustomerID in SQL using the command?"  
description: "How to select the last row of a particular CustomerID in SQL using the command?"  
author: "Ravi Vishwakarma"  
published: 2021-09-22  
updated: 2021-09-22  
canonical: https://www.mindstick.com/forum/156740/how-to-select-the-last-row-of-a-particular-customerid-in-sql-using-the-command  
category: "database"  
tags: ["database", "mysql", "sql server", "sql"]  
reading_time: 1 minute  

---

# How to select the last row of a particular CustomerID in SQL using the command?

How to [select](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) the last [row](https://www.mindstick.com/forum/1212/this-row-already-belongs-to-this-table) of a particular CustomerID in [SQL](https://www.mindstick.com/articles/13115/types-of-keys-in-sql-or-oracle-database) using the [command](https://www.mindstick.com/blog/178/synchronous-and-asynchronous-command-execution-in-c-sharp-dot-net)?

## Replies

### Reply by Ashutosh Kumar Verma

## SQL command is to select the particular last row:

The SQL statement is used to find the last row of any particular Person.

Lets take a database table 'Persons', **\**

![How to select the last row of a particular CustomerID in SQL using the command?](https://www.mindstick.com/mindstickforums/4f60cb8d-dccc-43cf-aec5-4d19aacf1e8d/images/f1d8cd30-1eda-4098-8e38-c2c3f703efad.png)

Now, the following SQL statement is used to find the last row of particular Person 'Ashu' in above table.

![How to select the last row of a particular CustomerID in SQL using the command?](https://www.mindstick.com/mindstickforums/4f60cb8d-dccc-43cf-aec5-4d19aacf1e8d/images/0095130b-3e2f-4826-9dfa-de96d290c8b9.png)\

Another following SQL statement is used to find the last row of particular Person 'Shriyam' in above table.

![How to select the last row of a particular CustomerID in SQL using the command?](https://www.mindstick.com/mindstickforums/4f60cb8d-dccc-43cf-aec5-4d19aacf1e8d/images/543433fb-dec2-4703-ac92-6369c6ec65be.png)\


---

Original Source: https://www.mindstick.com/forum/156740/how-to-select-the-last-row-of-a-particular-customerid-in-sql-using-the-command

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
