hey, i can't figure out how to get the top statement to work in mssql.. i'm pretty sure it has some version of it since it turns blue when i type it into the query analyzer.. when i write something like this SELECT TOP 1 Groups.Name FROM groups WHERE groups.parent_id = someID ORDER BY groups.last_update DESC it throws an error on the first line. saying "Incorrect syntax near '1'." i would just use the set rowcount method, but i want to use this as a subquery
anyone have any ideas? i'm running ms sql server 2000 here's another simple example.. SELECT TOP 1 * FROM phone gives me the error "Server: Msg 170, Level 15, State 1, Line 1 Line 1: Incorrect syntax near '1'." does anyone know why it's giving me that error? are there any other ways to do this? keeping in mind it will be a subquery.
here are some top examples (also see comments): http://josephlindsay.com/archives/2005/05/27/paging-results-in-ms-sql-server/ ...? havent used mssql for some years...
If you are in the correct DB it should work with SELECT TOP 1 * FROM dbo.phone or SELECT TOP 1 Name FROM dbo.groups WHERE parent_id = someID ORDER BY last_update DESC