|
Posted by David Portas on 05/04/06 00:39
rss@ddsc.com wrote:
> set rowcount 1
> select Idnum1,Idnum3 from mytable order by Idnum1 DESC, idnum3 ASC
>
> is equivelent to
> select first(Idnum1),first(idnum3) from mytable order by first(Idnum1)
> DESC ,first(Idnum3) ASC
>
>
> Isn't that silly? why did Microsoft not add an agregate function First
> for the Microsoft SQL Server to be consistent with its Microsoft Access
> product eh?
RANK() and ROW_NUMBER() are much more powerful alternatives. FIRST is
not a proper aggregate function, even in Access. RANK() and
ROW_NUMBER() are also ANSI-standard SQL functions. One would hope that
ANSI compatibility is a higher priority for inclusion than replicating
the peculiar quirks of Access.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Navigation:
[Reply to this message]
|