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)
 Simple query

Author  Topic 

salmonraju
Yak Posting Veteran

54 Posts

Posted - 2007-12-07 : 11:47:28
hi , I have table like below

TrainID UserID MsgType User Data CreatedDate (dd/mm/yy)
1111 1 SystemAinfo xtgdttggt 01/10/07
1112 1 SystemBinfo xtgsaadggt 04/10/07
1113 1 SystemCinfo xtgdsatggt 02/10/07
1114 2 SystemAinfo xtgdstggt 08/10/07
1115 2 SystemBinfo xtgdstggt 11/10/07
1116 2 SystemCinfo xtgdstggt 10/10/07
1117 1 SystemAinfo xtgdstggt 12/10/07
1118 1 SystemBinfo xtgdstggt 13/10/07
1119 2 SystemCinfo xtgdstggt 15/10/07

user have 3 types of messages (SystemAinfo,SystemBinfo,SystemAinfo)
for a 'particular user' a 'particular message' can appear number of times but with different createdDate (column)

i want a query to retrive UserData (column) value for SystemBinfo messageType that have maximum createDate for a particular user

from the above for userid 1 i need the below data
1118 1 SystemBinfo xtgdstggt 13/10/07

I need query that takes set of Users like

select UserData form Tab1 UserId in(1,2,3) with MessageType='SystemBinfo' having max(CreateDate)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-12-07 : 11:48:32
You reposted the same problem again even after you got an answer here?
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=93834



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

salmonraju
Yak Posting Veteran

54 Posts

Posted - 2007-12-07 : 11:57:35
Sorry i wont Checked that,i Thought that I have to post it on Sql server 2000, I appolise for that

How can I get for a set of User (given users) only like UserId in(1,2,3)

because my production server have lot of records
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-07 : 12:12:27
quote:
Originally posted by salmonraju

Sorry i wont Checked that,i Thought that I have to post it on Sql server 2000, I appolise for that

How can I get for a set of User (given users) only like UserId in(1,2,3)

because my production server have lot of records


Where userid in (1,2,3)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -