Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

about Equivalent of FIRST() function

Status
Not open for further replies.

arouhi

Programmer
Jul 7, 2001
29
US
Hi all,

I'm working on conversion of a VB application from MS Access database to SQL Server. in original source code , there are lot of SQL statement with jet SQL FIRST() function, for example :
Select Custno,Min(qtyShip),First(Shipvia) from SO Group by Custno;
I tried to use the original SQL , but I got Error message that says <'first' is not a recognized function name>.

is there any Equivalent for First() function in ANSI Sql ( in MS SQL Server 7.0 )

thanks
 

FIRST and LAST aggregate functions don't exist in ANSI-SQL nor T-SQL. The ANSI relational standard doesn't have table ordering so the concept of First and Last are Non-Relational.

You may be able to use MIN in some instances to replace FIRST. Or you may need to use Ordered result sets and/or the TOP predicate. Terry Broadbent
Please review faq183-874.

&quot;The greatest obstacle to discovery is not ignorance -- it is the illusion of knowledge.&quot; - Daniel J Boorstin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top