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
 General SQL Server Forums
 New to SQL Server Programming
 I need Sql Query Filtering Option

Author  Topic 

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-12 : 03:51:59


My table have many column.........One for Message(column).My table updating every seconds......

But I need last Message.........

Ex

Message(Column) ..............
-------
firstmsg
nextmsg
middlemsg
jsjfsjmsg
jhsffmsg
lastmsg

In table i need lastmsg--- How to get






khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-12 : 03:54:57
what is last Message ? latest record ? Do you have a datetime column that record the date / time the record is inserted ?


KH

Go to Top of Page

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-12 : 03:59:33
Ex

Message(Column) ..............
-------
firstmsg
nextmsg
middlemsg
jsjfsjmsg
jhsffmsg
lastmsg
--------
table closed

yes i have datetime in every msg
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-12 : 04:02:25
can you post your table DML, some sample record and the result that you required?


KH

Go to Top of Page

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-12 : 04:03:00
Ex

Message(Column) ..............
-------
firstmsg
secondmsg
thirdmsg
fouthmsg
fivthmsg
.....
.....
.....
lastmsg
--------
table closed

i have datetime column.. in table i need one value(lastmsg) how
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-12 : 04:06:06
something like this ?

select lastmsg
from Message
where datetimecol = (select max(datetimecol) from Message)



KH

Go to Top of Page

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-12 : 04:10:23

MsgID MsgPosting MSg MsgLastPosed

1 2007-03-12 10:47:56.340 How edit forum 2007-03-12 10:50:25.747
2 2007-03-12 10:53:31.217 How to Value Change 2007-03-12 10:56:36.373
3 2007-03-12 10:57:36.543 Sql Command 2007-03-12 11:00:25.047
4 2007-03-12 11:02:10.793 User Control 2007-03-12 11:02:10.793
5 2007-03-12 13:03:00.390 How I can uninstall 2007-03-12 13:07:51.233

this is my sample table Example
Go to Top of Page

Easwar
Yak Posting Veteran

59 Posts

Posted - 2007-03-12 : 04:15:14
very very thanks sir.... That query worked
Go to Top of Page
   

- Advertisement -