
Originally Posted by
Ajax
to get the last order, you need one or more fields to indicate a sort order and therefore can identify the last record.
So assuming orderids increment on creation then you could use
SELECT T.*
FROM tblOrders T INNER JOIN (SELECT UserID, max(OrderID) maxOrder FROM tblOrders GROUP BY UserID) Q ON T.UserID=Q.UserID AND T.OrderID=Q.maxOrder
If they don't increment then you would also need to use the Orderdate field as well, but in your example all orders have the same date, so no discernible order can be made.