Home All Groups Group Topic Archive Search About
Author
22 Jul 2005 3:38 PM
Mark Thomson
I have a simple table that stores

name     score
------      -----
jim         343
bob        322
jane       122


Lets say i have a user defined function that applys a formula to the score
and I want to select the minimum value of the function.

eg.

SELECT name, score, MIN(dbo.alterScore(score))
FROM tester


I want to return the smallest value of the when the function is applied
along with the name and score.

How can I do this?

Many thanks.

Author
22 Jul 2005 3:43 PM
Narayana Vyas Kondreddi
One way is:

SELECT TOP 1 name, score, MIN(dbo.alterScore(score)) AS MinScore
FROM tester
ORDER BY MinScore

--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @ http://vyaskn.tripod.com/


"Mark Thomson" <@@@> wrote in message
news:uZVc3NtjFHA.2852@TK2MSFTNGP15.phx.gbl...
I have a simple table that stores

name     score
------      -----
jim         343
bob        322
jane       122


Lets say i have a user defined function that applys a formula to the score
and I want to select the minimum value of the function.

eg.

SELECT name, score, MIN(dbo.alterScore(score))
FROM tester


I want to return the smallest value of the when the function is applied
along with the name and score.

How can I do this?

Many thanks.
Author
22 Jul 2005 4:21 PM
Jeremy Williams
Why did you post the same question twice to the same group within 30 minutes
of each other?!

Your question was already answered (by multiple people) in your previous
thread titled "Easy SQL Problem"

Show quote
"Mark Thomson" <@@@> wrote in message
news:uZVc3NtjFHA.2852@TK2MSFTNGP15.phx.gbl...
> I have a simple table that stores
>
> name     score
> ------      -----
> jim         343
> bob        322
> jane       122
>
>
> Lets say i have a user defined function that applys a formula to the score
> and I want to select the minimum value of the function.
>
> eg.
>
> SELECT name, score, MIN(dbo.alterScore(score))
> FROM tester
>
>
> I want to return the smallest value of the when the function is applied
> along with the name and score.
>
> How can I do this?
>
> Many thanks.
>
>

AddThis Social Bookmark Button