Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select statement query

Author  Topic 

ninu
Starting Member

7 Posts

Posted - 2006-10-04 : 11:08:59
Hi,

I have a table called notes, with thousands of rows of "notes" entered by customer services agents. Each row has an account number, date and username columns.

An account can have many notes on thetable.

How can I select the last two notes on the table left for each account? Trying to use select top 2, but of course it's only giving me the top 2 notes for ALL accounts.

Please help.

Thanks very much.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-10-04 : 11:18:43
http://weblogs.sqlteam.com/mladenp/archive/2005/08/01/7421.aspx
point 2



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

ninu
Starting Member

7 Posts

Posted - 2006-10-04 : 12:27:00
Thank you, that worked!
Go to Top of Page
   

- Advertisement -