Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 3 of 3 total |
Showing last 10 records using rowcount, or some other way |
Mon, Dec 31 2012 1:31 PM | Permanent Link |
John Postnikoff | I am trying to do something like this below in a C/S application. I would like to get the last 10 orders for a customer. I see there is a range option, however I am not sure if that would work for me when the data is constantly changing by the minute.
SET ROWCOUNT 10 SELECT * FROM DeliveryOrders WHERE CustomerAccount = 2039 ORDER BY DeliveryDate John Postnikoff |
Mon, Dec 31 2012 2:16 PM | Permanent Link |
Raul Team Elevate | John,
Range is exactly what you need. Nor sure what your table looks like but you'd need to use something like this: SELECT * FROM DeliveryOrders WHERE customerAccount=2039 ORDER BY OrderData DESC RANGE 1 TO 10 The range limits you to 10 and descending sort by OrderDate ensures you get last 10 (replace the orderdate by whatever field in your table determines the proper ordering) Raul On 12/31/2012 1:31 PM, John Postnikoff wrote: > I am trying to do something like this below in a C/S application. I would like to get the last 10 orders for a customer. I see there is a range option, however I am not sure if that would work for me when the data is constantly changing by the minute. > > SET ROWCOUNT 10 SELECT * FROM DeliveryOrders WHERE CustomerAccount = 2039 > ORDER BY DeliveryDate > > John Postnikoff > |
Mon, Dec 31 2012 8:58 PM | Permanent Link |
John Postnikoff | Thanks Raul! That worked awesome for me. Raul wrote: John, Range is exactly what you need. Nor sure what your table looks like but you'd need to use something like this: SELECT * FROM DeliveryOrders WHERE customerAccount=2039 ORDER BY OrderData DESC RANGE 1 TO 10 The range limits you to 10 and descending sort by OrderDate ensures you get last 10 (replace the orderdate by whatever field in your table determines the proper ordering) Raul On 12/31/2012 1:31 PM, John Postnikoff wrote: > I am trying to do something like this below in a C/S application. I would like to get the last 10 orders for a customer. I see there is a range option, however I am not sure if that would work for me when the data is constantly changing by the minute. > > SET ROWCOUNT 10 SELECT * FROM DeliveryOrders WHERE CustomerAccount = 2039 > ORDER BY DeliveryDate > > John Postnikoff > |
This web page was last updated on Friday, April 26, 2024 at 06:09 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |