Question : last 3 rows returned in a group - using slq server 8.0.760

I want to be able to return last 3 invoices by customer - eg
Customer_No            Date             Inv No            Amount
1234                  01/01/2010      1            £125
1234                  03/02/2010      2            £456
1234                  04/02/2010      3            £434
1234                  01/04/2010          4            £0
1234                  06/06/2010      5            £789
2234                  01/01/2010      456            £3125
2234                  03/02/2010      4562            £456
2234                  04/02/2010      4563            £434
2234                  01/04/2010          4564            £50
2234                  06/06/2010      4565            £6789

My returned data should be as follows

Customer_No            Date             Inv No            Amount
1234                  04/02/2010      3            £434
1234                  01/04/2010          4            £0
1234                  06/06/2010      5            £789
2234                  04/02/2010      4563            £434
2234                  01/04/2010          4564            £50
2234                  06/06/2010      4565            £6789
Regards

Answer : last 3 rows returned in a group - using slq server 8.0.760

what about:
1:
2:
3:
select t.*
  from yourtable t
 where t.invno in ( select top 3 i.invno from yourtable i where i.Customer_No  = t.Customer_No  order by i.[Date] desc )          
Random Solutions  
 
programming4us programming4us