You are here: Re: get value of last item in column? « MsSQL Server « IT news, forums, messages
Re: get value of last item in column?

Posted by Greg D. Moore \(Strider\) on 03/12/07 10:44

<andreas.hei@googlemail.com> wrote in message
news:1173689649.827708.218050@n33g2000cwc.googlegroups.com...
> Thank you very much, but my question is more like how to get the exact
> VALUE of the field (not the minimum or maximum)?

Not sure what you mean by the exact value of the field. How do you define
last item in column.

Generally that means the min or max value.

If you can give us some example data perhaps we can give a better solution?


>
> is there a command/query for it?
>
>
>
>
> On 7 mar, 18:54, "Plamen Ratchev" <Pla...@SQLStudio.com> wrote:
>> You can use TOP 1 to return only 1 row (based on the ORDER BY), something
>> like this:
>>
>> SELECT TOP 1 COLUMN FROM TABLE ORDER BY COLUMN DESC
>>
>> Also, MIN(COLUMN) and MAX(COLUMN) may work depending on how you define
>> last
>> item, like:
>>
>> SELECT MAX(COLUMN) FROM TABLE
>>
>> Regards,
>>
>> Plamen Ratchevhttp://www.SQLStudio.com
>
>



--
Greg Moore
SQL Server DBA Consulting
Email: sql (at) greenms.com http://www.greenms.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация