Solved

SQL get latest 5 rows

Posted on 2009-04-03
2
184 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
ID: 24058032
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
ID: 31566163
Excellent, thanks a lot!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
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.​
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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