How to find 11th entry in SQL Access database table?

后端 未结 2 831
醉酒成梦
醉酒成梦 2020-12-07 06:15

How would I find the 11th entry in an Access SQL database table? I have to use the TOP function, and my query currently looks like this:

SELECT TOP 11 Pass         


        
相关标签:
2条回答
  • 2020-12-07 06:49

    You can use a subquery:

    SELECT TOP 1 T.Name, T.[Total Amount Spent on Tickets]
    FROM
    
    (SELECT TOP 11 Passenger.Name, SUM(Manifest.Ticketprice) AS [Total Amount Spent on Tickets]
    FROM Passenger INNER JOIN Manifest ON Passenger.PassengerNumber=Manifest.PassengerNumber
    GROUP BY Passenger.Name
    ORDER BY SUM(Manifest.Ticketprice) DESC) As T
    
    ORDER BY T.[Total Amount Spent on Tickets] ASC
    
    0 讨论(0)
  • 2020-12-07 06:58
    SELECT TOP 11 Passenger.Name, SUM(Manifest.Ticketprice) AS [Total Amount Spent on Tickets]
    FROM Passenger INNER JOIN Manifest ON Passenger.PassengerNumber=Manifest.PassengerNumber
    GROUP BY Passenger.Name
    ORDER BY SUM(Manifest.Ticketprice) DESC LIMIT 1;
    
    0 讨论(0)
提交回复
热议问题