create table YourTable (Agent_ID int, Modified datetime, col1 varchar(10), col2 varchar(10))
insert into YourTable (Agent_ID,Modified,Col1,Col2)
select 1 , '2004-06-02 11:30:00','Sedr','foobar' union all select
1 , '2005-04-02 09:30:00','fg','4t34' union all select
1 , '2001-03-11 14:33:00','fae','fa3' union all select
2 , '2004-11-30 12:00:00' , 'dsae','aer3' union all select
2 , '2006-12-12 11:30:00', 'er','er43'
select * from YourTable
where Agent_ID + Modified in
(select Agent_id + max(modified) as Foo From YourTable group by Agent_id)
drop table YourTable
It worked. Could be luck. You are right that i should cast them as the same thing then concatenate them.
[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp