Solved

SQL get latest 5 rows

Posted on 2009-04-03
2
179 Views
Last Modified: 2012-05-06
Hi Experts,
I have the following table
vessel | reportdatetime | latitude | longitude
From the table I need the latest 5 latitude and longitudes for a particular vessel. Mostly there are more then 5 rows, but it can be less or zero.

Can someone give me some assistence?
Regards, MB
0
Comment
Question by:mark_norge
2 Comments
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
Comment Utility
replace vessel = 1 with your perticular value


select top 5 * from tablename
where vessel = 1
order by reportdatetime desc
0
 

Author Closing Comment

by:mark_norge
Comment Utility
Excellent, thanks a lot!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now