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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Equivalent of a First function in SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-10-03 : 09:47:10
Gary writes "I have checked the reference material and I cannot find any reference to a 'First' type aggregate function.

I am converting to SQL Server 7 (NT 4) from Access 2000 and the creator has used 'First' all over the place. I have been asked to convert the database and rationalise the SQL.

Do you know a way of returning the first value of the column in the table?

Regards

Gary"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-10-03 : 10:04:18
There is no concept of first in relational mathematics. There is no concept of first in set theory.

What would the bartender to if you sat down at the bar and said "give me your fist beer"? He would likely look at you strange.

First implies that your rows are physically stored in some order. However, RDBMSs deal with rows in sets. There is no order property of a set.

That being said, you can do some things to get the results you are after. You can say, "give me your cheapest beer" or "give me your oldest beer" or even "put your beers in alphabetical order and give me the lowest (first) one".

Make sense?

Jay White
{0}
Go to Top of Page
   

- Advertisement -