Solved

SQL get latest 5 rows

Posted on 2009-04-03
2
182 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

947 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

18 Experts available now in Live!

Get 1:1 Help Now