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 2005 Forums
 Transact-SQL (2005)
 Getting the last column value

Author  Topic 

iceman_23
Starting Member

6 Posts

Posted - 2008-06-04 : 04:55:06
Hello Guys,

Will you be so kind to give me a syntax that would get the last column value.

LAST and MIN is not working in SSRS. Though the LAST function is working on MS Visual Studio.

Thanks.

ic3m@n

raky
Aged Yak Warrior

767 Posts

Posted - 2008-06-04 : 05:08:49
quote:
Originally posted by iceman_23

Hello Guys,

Will you be so kind to give me a syntax that would get the last column value.

LAST and MIN is not working in SSRS. Though the LAST function is working on MS Visual Studio.

Thanks.

ic3m@n


Do you mean to get last row?? then

select top 1 * from tablename order by Primarykeycolumn desc

if u want to get any column either first or last
specify columnname in select list

select lastcolumnname < Required column> from TableName
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-04 : 05:10:24
quote:
Originally posted by iceman_23

Hello Guys,

Will you be so kind to give me a syntax that would get the last column value.
LAST and MIN is not working in SSRS. Though the LAST function is working on MS Visual Studio.

Thanks.

ic3m@n


what do you mean by last column? last value in a column? or column whose position is last in the table? or maximum value of data in the column?
Go to Top of Page

iceman_23
Starting Member

6 Posts

Posted - 2008-06-04 : 05:32:26
Thanks guys!!

The last value in a column.

The column that Im taking was created by a predefined function. And Im having a difficulty in using that predefined column in a SELECT statement.

Thanks.

ic3m@n
Go to Top of Page

raky
Aged Yak Warrior

767 Posts

Posted - 2008-06-04 : 05:39:07
select top 1 lastcolumnname from tablename order by Primarykeycolumn desc
Go to Top of Page
   

- Advertisement -